Skip to content

Instantly share code, notes, and snippets.

@npilon
Last active March 6, 2018 20:53
Show Gist options
  • Save npilon/9f3c8469a615081fc8454359945eebd7 to your computer and use it in GitHub Desktop.
Save npilon/9f3c8469a615081fc8454359945eebd7 to your computer and use it in GitHub Desktop.
Demonstrate over-aggressive synchronous subtask check in eager application
"""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