예제 #1
0
 def add_task(cls, user, task_key, async_task):
     """
     Adds a task to store. If you run a task and want to watch it - add it here!
     :param user: the user whom this task belongs to
     :param task_key: task id
     :param async_task: the async task object. Usually it is `celery.result.AsyncResult`
     """
     QUEUED_TASKS.set(user, task_key, async_task)
예제 #2
0
 def get_tasks_info(cls, user):
     """
     Get a status of user's tasks
     :param user:
     :return: a dictionary of tasks
     """
     # Pass False if you don't want your tasks to be deleted from Redis when they're finished.
     return QUEUED_TASKS.get(user, False)