Last active
October 7, 2015 14:51
-
-
Save eMerzh/164f7d85fee91383e12b to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
from celery import Celery, group, chain, chord | |
app = Celery('tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0?new_join=1') | |
app.conf.CELERY_CHORD_PROPAGATE = True | |
@app.task | |
def add(x): | |
if(x == 3): | |
raise Exception('arg') | |
print x | |
@app.task() | |
def tend(): | |
print "this is the end" | |
lst = [add.si(1),add.si(2), add.si(3)] | |
chord(lst)(tend.si()) | |
# | |
# [2015-10-07 16:50:23,062: WARNING/Worker-4] 1 | |
# [2015-10-07 16:50:23,064: INFO/MainProcess] Received task: test.add[e37117be-d087-4324-855d-5d409b3c3e85] | |
# [2015-10-07 16:50:23,064: WARNING/Worker-5] 2 | |
# [2015-10-07 16:50:23,066: INFO/MainProcess] Task test.add[e4370b23-fe1c-4c91-a5f8-9ad7c0b5f06d] succeeded in 0.00449428195134s: None | |
# [2015-10-07 16:50:23,067: INFO/MainProcess] Task test.add[ab6330f0-da73-4bdf-bcd1-fb34aec09453] succeeded in 0.00339785998221s: None | |
# [2015-10-07 16:50:23,070: ERROR/Worker-1] Chord callback for '4676180e-9481-425c-aa56-8f008bf2eae5' raised: ChordError("Dependency e37117be-d087-4324-855d-5d409b3c3e85 raised <ExceptionInfo: Exception('arg',)>",) | |
# Traceback (most recent call last): | |
# File "venv/lib/python2.7/site-packages/celery/backends/redis.py", line 224, in _new_chord_return | |
# callback.delay([unpack(tup, decode) for tup in resl]) | |
# File "venv/lib/python2.7/site-packages/celery/backends/redis.py", line 187, in _unpack_chord_result | |
# raise ChordError('Dependency {0} raised {1!r}'.format(tid, retval)) | |
# ChordError: Dependency e37117be-d087-4324-855d-5d409b3c3e85 raised <ExceptionInfo: Exception('arg',)> | |
# [2015-10-07 16:50:23,073: ERROR/MainProcess] Task test.add[e37117be-d087-4324-855d-5d409b3c3e85] raised unexpected: Exception('arg',) | |
# Traceback (most recent call last): | |
# File "venv/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task | |
# R = retval = fun(*args, **kwargs) | |
# File "venv/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__ | |
# return self.run(*args, **kwargs) | |
# File "test.py", line 10, in add | |
# raise Exception('arg') | |
# Exception: arg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment