Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stellasia opened this issue Sep 5, 2016 · 3 comments
Open

Comments

@stellasia
Copy link

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!

@stellasia stellasia changed the title Compatibility with latest celery release? AttributeError: 'dict' object has no attribute 'app' with django Sep 6, 2016
@stellasia
Copy link
Author

After more tests, the code above in a simple project works fine (even with last celery release!).
I still have the error when this code is run inside a django app.

@0x0elliot
Copy link

i know that this is a 6-year-old thread, but has anyone figured out an explanation for this yet?

@stellasia
Copy link
Author

I don't really remember (not working anymore on the project that triggered the issue), but I don't think I ended up using this package in the end. It was probably replaced by this one: https://github.com/spotify/luigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants