Skip to content

AttributeError: 'dict' object has no attribute 'app' with django #7

@stellasia

Description

@stellasia

Hi,

This project has not been updated for a while... Is it still compatible with latest celery releases (3.1.23 at the time of writing)?

FYI, when running the example below:

from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)

from celery_tasktree import task_with_callbacks, TaskTree

@task_with_callbacks
def some_action(x):
    logger.info(x)

def execute_actions():
    tree = TaskTree()
    task0 = tree.add_task(some_action, kwargs={"x":"0"})
    task1 = tree.add_task(some_action, kwargs={"x":"1"})
    task10 = task1.add_task(some_action, kwargs={"x":"10"})
    task11 = task1.add_task(some_action, kwargs={"x":"11"})
    task110 = task11.add_task(some_action, kwargs={"x":"110"})
    async_result = tree.apply_async()
    return async_result

I got the following error :

[2016-09-05 16:56:27,481: WARNING/MainProcess] celery@pc ready.
[2016-09-05 16:56:32,449: INFO/MainProcess] Events of group {task} enabled by remote.
[2016-09-05 16:56:38,771: INFO/MainProcess] Received task: tasks.some_action[548166d1-5cad-4801-8792-1098d1f85198]
[2016-09-05 16:56:38,773: INFO/MainProcess] Received task: tasks.some_action[a9a89c44-6e78-46cc-906b-e12362396b57]
[2016-09-05 16:56:38,774: INFO/Worker-1] tasks.some_action[548166d1-5cad-4801-8792-1098d1f85198]: 0
[2016-09-05 16:56:38,774: INFO/Worker-4] tasks.some_action[a9a89c44-6e78-46cc-906b-e12362396b57]: 1
[2016-09-05 16:56:38,781: INFO/MainProcess] Task tasks.some_action[548166d1-5cad-4801-8792-1098d1f85198] succeeded in 0.00667091600189s: None
[2016-09-05 16:56:38,783: ERROR/MainProcess] Task tasks.some_action[a9a89c44-6e78-46cc-906b-e12362396b57] raised unexpected: AttributeError("'dict' object has no attribute 'app'",)
Traceback (most recent call last):
  File ".../local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File ".../local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File ".../venv/local/lib/python2.7/site-packages/celery_tasktree.py", line 142, in wrapper
    async_result = _exec_callbacks(callback)
  File ".../venv/local/lib/python2.7/site-packages/celery_tasktree.py", line 160, in _exec_callbacks
    async_result = taskset.apply_async()
  File ".../local/lib/python2.7/site-packages/celery/canvas.py", line 502, in apply_async
    type = self.type
  File ".../local/lib/python2.7/site-packages/celery/canvas.py", line 569, in type
    return self.app.tasks[self['task']]
  File ".../local/lib/python2.7/site-packages/celery/canvas.py", line 560, in app
    return self._app or (self.tasks[0].app if self.tasks else current_app)
AttributeError: 'dict' object has no attribute 'app'

Thanks for any feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions