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
Celery doesn't fetch settings properly #4198
Comments
The actual old value is |
@pachewise do you know how to fix this issue? |
not yet @lcd1232 - still trying to understand how |
@pachewise @lcd1232 I do not see the issue exactly. If I do the following:
The configuration contains the |
@georgepsarakis turns out there were some misconfigurations, though there is a weird quirk that @lcd1232 You forgot to update your CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672' # change to match your AMQP
CELERY_TASK_ROUTES = {
'main.tasks.*': {
'queue': 'site.tasks.supertest',
}
} |
Perhaps we need to add the configuration example to the documentation? |
I'm facing the same issue, what is the work around for this, I am not able to use Same issue found in stackoverflow, I ended up defining the queue in the decorator itself like they suggested. Its working now, but I want to be able to have all the queues and tasks a the same location. Django: 1.11 |
@syllogismos - there wasn't an issue for OP's particular case, they had misconfigured. what's your |
Mine is a django app, and I was trying to use different queues for different tasks. And SQS backed.. I tried both SQS and redis but in both cases, the messages are only going to the default queue. So my
I tried various config options like defining |
do you have an CELERY_TASK_ROUTES = {
'app.tasks.my_task': {
'queue': 'my_queue'
}
} this should be in your settings.py, and then you'll have to load the settings from your app; for example: app = Celery('7vpn')
app.config_from_object('absolute.import.to.settings') # TODO replace with correct import path
# you should also be able to pass in the django.conf.settings object, but I haven't tried that |
I did try that. It didn't work for me. But haven't tried the Anyway I printed the app.conf object after loading the config, and I do see the routes settings when i print them using app.conf['task_routes'] but dont see them when I print the app.conf object. Also note that other celery settings are being applied, like celeyd_log_format and things like that. I only have problem with task_routes. edit: I tried the absolute import to of the settings file in config_from_object it also uses the default queue even if I define something else. I even have the 'queue' keyword in the settings like you suggested. I even tried defining celery_task_queues with exchange key, routing key even thought in documentation its said that sqs and redis don't need this. And then used these queues in the routes config. None of it worked. |
It turns out that this get properly parsed and runs fine for me: CELERY_QUEUES = (Broadcast('broadcast-tasks'),)
CELERY_ROUTES = {
'app.tasks.my_task': {
'queue': 'broadcast-tasks'
}
} CELERY_TASK_QUEUES and CELERY_TASK_ROUTES does not work and that's what I was trying initially. I initialized the app with a custom Would be great to see the whole mess around old and new naming being fixed soon as it already bit quite some people. Not sure if it would be feasible to deprecate old naming scheme and only support the new one. |
I just went through the same thing (using Flask, not Django, for what it's worth). |
Just wasted an hour on this. Guys, please fix the documentation. How hard can it be to rename some variables in the documentation? |
If you come here confused about the difference between |
It may cuased by kombu. at first my env were: after changed to: problem solved! |
Checklist
master
branch of Celery.Steps to reproduce
Install project - https://github.com/lcd1232/celery_django_test
The problem is that celery doesn't get settings CELERY_TASK_ROUTES https://github.com/lcd1232/celery_django_test/blob/752d45f43ba0a141ca23a36bb3a3ef76e9886391/celery_test/settings.py#L123 but if uncomment celery_test/celery.py:21-25 all works as expected.
Update
I localized the problem. https://github.com/celery/celery/blob/master/celery/app/utils.py#L217
For example if we have in settings.py
TASK_ROUTES
,is_in_new
andis_in_old
will be empty set because'TASK_ROUTES' != 'task_routes'
.If we have in settings.py 'task_routes', variable
source
will not containtask_routes
The text was updated successfully, but these errors were encountered: