Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @shared_task
- def add(x, y):
- return x + y
- @shared_task
- def tsum(numbers):
- return sum(numbers)
- @shared_task
- def all_in_one():
- return chord(
- (add.s(x, x*2) for x in range(0, 5)), tsum()
- )()
- def start():
- result = all_in_one.delay()
- print type(result) # <class 'celery.result.AsyncResult'>
- print result # 05d8872b-9fd2-4b57-b9ae-57e9e9518a55
- res = result.wait()
- print type(res) # <type 'list'>
- print res # [[u'f1ce1b79-28d0-4766-a741-8c49de337475', [[u'078c014e-0e04-414d-bc8f-c084ad1a7ab1', None], [[[u'256be58b-9758-4d46-98f9-985073b0a2bc', None], None], [[u'a708b813-a89d-48d6-beeb-f314168a4364', None], None], [[u'80f50bd8-e0b6-4ca5-b648-af65c0d994aa', None], None], [[u'847bd1cc-1d97-4d46-859f-0736a697af0d', None], None], [[u'0a12788d-15ce-41f1-afb1-790bc8672c20', None], None]]]], None]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement