Last active
March 6, 2018 20:53
-
-
Save npilon/9f3c8469a615081fc8454359945eebd7 to your computer and use it in GitHub Desktop.
Demonstrate over-aggressive synchronous subtask check in eager application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Celery master is too aggressive about suppressing .get() in eager tasks. | |
test performs no synchronous operations, but fails in eager application:: | |
python minimal_eager_chain.py shell --config=minimal_eager_chain | |
test.delay().get() | |
""" | |
import celery | |
from celery.canvas import chord | |
app = celery.Celery() | |
CELERY_RESULT_BACKEND = "redis://localhost/0" | |
CELERY_ALWAYS_EAGER = True | |
@app.task() | |
def a(): | |
return 42 | |
@app.task() | |
def b(ar): | |
return ar | |
@app.task() | |
def test(): | |
( | |
a.s() | b.s() | |
).apply_async() | |
def main(): | |
app.start() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment