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.execute.send_task should respect CELERY_ALWAYS_EAGER #581
Comments
send_task can be used when there is no access to task class. In that case it is not possible to execute the task locally when CELERY_ALWAYS_EAGER is enabled. |
Yeah, that would be weird, as the task may not be registered. It should be fairly easy to add this behavior to your own code though. |
This make sense. Maybe docs are worth changing then? This behavior is not clear from the docs: http://celery.readthedocs.org/en/latest/configuration.html#celery-always-eager
http://celery.readthedocs.org/en/latest/userguide/executing.html#basics
|
This has bitten me too- any reason we can't pull the task class itself from the registry and run it so we get some consistent behaviour for CELERY_ALWAYS_EAGER? Otherwise we should call it CELERY_MOSTLY_EAGER ;-) |
Closed by 703cba6 unittests should mock the call to
|
great! the issue isn't resolved though, so why are we closing it? it either needs to be fixed, or the inconsistency documented. |
I think 703cba6 is the way it got documented. |
There is a semantic difference between I don't mind this being documented with the |
When testing django apps, I do some monkey patching to get the same result as In settings.py:
Then in tests/celery.py I have (could use some feedback on this):
|
Thanks for posting your solution, you could shorten it a bit:
This will return a EagerResult though, like with ALWAYS_EAGER, |
Proper solution? |
Would be great to have proper solution. Is there any? |
@ask ? |
ask do not maintain celery anymore. |
Trying to figure out why CELERY_ALWAYS_EAGER doesn't work I found that celery.app.base.BaseApp.send_task (and thus celery.execute.send_task) doesn't respect CELERY_ALWAYS_EAGER.
I think CELERY_ALWAYS_EAGER should be respected both for direct task invocations (via task.delay) and for indirect invocations (via execute.send_task).
The text was updated successfully, but these errors were encountered: