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

get_key_for_task in celery.backends.base fails on AsyncResult(None) #1996

Closed
zupo opened this issue Apr 21, 2014 · 3 comments
Closed

get_key_for_task in celery.backends.base fails on AsyncResult(None) #1996

zupo opened this issue Apr 21, 2014 · 3 comments

Comments

@zupo
Copy link

zupo commented Apr 21, 2014

If I instantiate an AsyncResult with None, and then call "res.state", I will get a TypeError. The error occurs because task_id of "res" is None, and one cannot join a list of strings and None.

Traceback:

TypeError: sequence item 1: expected string, NoneType found - 
celery/result.py in state:
celery/result.py in _get_task_meta:
celery/backends/base.py in get_task_meta:
celery/backends/base.py _get_task_meta_for:
celery/backends/base.py in get_key_for_task:
         return key_t('').join([
             self.task_keyprefix, key_t(task_id), key_t(key),
         ])

celery report:

software -> celery:3.1.10 (Cipater) kombu:3.0.14 py:2.7.4
            billiard:3.3.0.14 py-amqp:1.4.4
platform -> system:Linux arch:64bit, ELF imp:CPython
loader   -> celery.loaders.default.Loader
settings -> transport:amqp results:redis://url

CELERY_TRACK_STARTED: True
CELERYD_TASK_TIME_LIMIT: 600.0
BROKER_POOL_LIMIT: 1
CELERY_ACKS_LATE: True
BROKER_URL: 'amqp://url'
CELERYD_CONCURRENCY: 1
CELERY_RESULT_BACKEND: 'redis://url'
CELERY_TIMEZONE: 'UTC'
CELERY_ACCEPT_CONTENT: ['pickle']
@ask
Copy link
Contributor

ask commented Apr 23, 2014

What would you expect to happen here?

@zupo
Copy link
Author

zupo commented Apr 23, 2014

That's a good question indeed. One option would be to return an empty string or None as result.status. The other would be to raise a more descriptive exception. I don't have a good argument as to which one of these is better.

@ask ask closed this as completed in 1b70f9e Oct 8, 2014
@zupo
Copy link
Author

zupo commented Oct 8, 2014

Thanks!

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