Cannot add link to group: do that on individual tasks
Package:
celery
17847

Exception Class:
TypeError
Raise code
ly_async(self, args=None, kwargs=None, add_to_parent=True,
producer=None, link=None, link_error=None, **options):
args = args if args else ()
if link is not None:
raise TypeError('Cannot add link to group: use a chord')
if link_error is not None:
raise TypeError(
'Cannot add link to group: do that on individual tasks')
app = self.app
if app.conf.task_always_eager:
return self.apply(args, kwargs, **options)
if not self.tasks:
return self.freeze()
opti
🙏 Scream for help to Ukraine
Today, 14th August 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too!
We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.
Links to the raise (1)
https://github.com/celery/celery/blob/fc57a612c07c8121ad6606a20641e4da35de00b3/celery/canvas.py#L1078Ways to fix
Error code:
from celery import canvas
#Create Signatures
s = canvas.signature('tasks.add', args=(2, 2))
b = canvas.signature('tasks.add', args=(4,4))
#Creates a group of tasks
lazy_group = canvas.group([s, b])
lazy_group.apply_async(link_error='link of error')
Summary:
The exception is thrown in the apply_async
method when calling the Group class which creates a group of tasks to be executed in parallel.
So that, when apply_async is called with parameter link_error, it will throw an error.
if link_error is not None:
raise TypeError(
'Cannot add link to group: do that on individual tasks')
Fix code:
from celery import canvas
#Create Signatures
s = canvas.signature('tasks.add', args=(2, 2))
b = canvas.signature('tasks.add', args=(4,4))
#Creates a group of tasks
lazy_group = canvas.group([s, b])
lazy_group.apply_async()
Add a possible fix
Please authorize to post fix