Module Expr Str Import alias Import alias ImportFrom alias ImportFrom alias alias alias alias alias ImportFrom alias Assign NameStore Call NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str CompareEq NameLoad Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str If CompareIn Str AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Str FunctionDef arguments args defaults body Return Call NameLoad Str decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Num keyword NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Num keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call NameLoad BinOpAdd Str AttributeLoad NameLoad attr decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Return IfExp NameLoad Call NameLoad Str keyword NameLoad Call NameLoad Str decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Return TupleLoad Str Num Assign NameStore IfExp NameLoad CompareIsNot AttributeLoad NameLoad attr NameLoad NameLoad Return Call NameLoad keyword NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot NameLoad body Return Call NameLoad Str Assign NameStore AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Return Call NameLoad BinOpAdd Str NameLoad Expr Call AttributeLoad NameLoad attr Return Call NameLoad Str keyword NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Return TupleLoad Call NameLoad Str keyword Str keyword Str Num decorator_list Call AttributeLoad NameLoad attr Num FunctionDef arguments args NameParam defaults body Assign NameStore Str Assign NameStore Str Assign NameStore BinOpMod Str IfExp AttributeLoad NameLoad attr NameLoad NameLoad Return TupleLoad Call NameLoad Str keyword Str keyword NameLoad Num decorator_list Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad If BoolOpOr CompareEq Call AttributeLoad AttributeLoad NameLoad attr attr Str Str UnaryOpNot NameLoad body ImportFrom alias Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Call AttributeLoad AttributeLoad NameLoad attr attr Str keyword Call AttributeLoad AttributeLoad NameLoad attr attr Str keyword NameLoad keyword NameLoad
N/A N/A Hello Redis Tasks
A quick example of how to use Redis as a task queue.
 N/A logging.config N/A os redis ConnectionError flask Flask render_template request redirect jsonify tasks add N/A app N/A Flask __name__ N/A N/A N/A app config N/A DEBUG N/A __name__ __main__ N/A N/A N/A N/A app config from_pyfile config.py N/A N/A LOGGING N/A app config N/A N/A N/A N/A N/A logging config dictConfig N/A N/A app config N/A LOGGING index N/A N/A N/A N/A N/A N/A render_template index.html N/A N/A N/A app route / add_start N/A N/A N/A N/A N/A Grabs the args from the URL, starts the task, then redirects to show progress. N/A x N/A N/A N/A request args get x 2 type int N/A y N/A N/A N/A request args get y 3 type int N/A task N/A N/A add delay x y N/A N/A redirect N/A /progress?tid= N/A task id N/A N/A N/A app route /add add_progress N/A N/A N/A N/A N/A Shows the progress of the current task or redirect home. N/A task_id N/A N/A N/A request args get tid N/A N/A task_id N/A render_template progress.html task_id task_id N/A redirect / N/A N/A N/A app route /progress add_poll N/A N/A N/A N/A N/A Called by the progress page using AJAX to check whether the task is complete. N/A task_id N/A N/A N/A request args get tid N/A N/A N/A task N/A N/A add get_task task_id N/A N/A N/A ConnectionError N/A N/A N/A Coult not connect to the task queue. Check to make sure that <strong>redis-server</strong> is running and try again. 500 N/A ready N/A task N/A N/A task return_value None None N/A N/A jsonify ready ready N/A N/A N/A app route /poll add_results N/A N/A N/A N/A N/A When poll_task indicates the task is done, the progress page redirects here using JavaScript. N/A task_id N/A N/A N/A request args get tid N/A task N/A N/A add get_task task_id N/A N/A task N/A N/A N/A redirect / N/A result N/A task return_value N/A N/A result N/A N/A N/A redirect N/A /progress?tid= task_id N/A N/A N/A task delete N/A N/A render_template results.html value result N/A N/A N/A app route /results page_not_found N/A N/A e N/A N/A N/A N/A N/A render_template error.html message Not Found description The requested URL was not found on the server. 404 N/A N/A N/A app errorhandler 404 connection_error N/A N/A e N/A N/A N/A debug_description <strong>redis-server</strong> is N/A production_description both <strong>redis-server</strong> and <strong>worker.py</strong> are N/A description N/A Check to make sure that %s running. N/A N/A app debug debug_description production_description N/A N/A N/A render_template error.html message Coult not connect to the task queue description description 500 N/A N/A N/A app errorhandler ConnectionError N/A N/A __name__ __main__ N/A N/A debug N/A N/A N/A app config get DEBUG True N/A use_reloader N/A N/A N/A app config get DEBUG True N/A N/A N/A N/A N/A N/A os environ get WERKZEUG_RUN_MAIN true N/A use_reloader N/A worker TaskWorker N/A worker N/A TaskWorker app debug debug N/A N/A N/A worker reset N/A N/A N/A worker start N/A N/A N/A app run host N/A N/A N/A app config get HOST port N/A N/A N/A app config get PORT debug debug use_reloader use_reloader