Celery -Bound Tasks

A task being bound means the first argument to the task will always be the task instance (self).
Bound tasks are needed for retries (using app.Task.retry()), for accessing information about the current task request, and for any additional functionality you add to custom task base classes. Ref

An example to get the tasks ID of current tasks has been added below :

def get_ID(self):
print “hooo”
print self.request.id

It is always a good practice to give names to tasks otherwise it will go for automatic  naming which in some situation may lead to tasks unregistered error.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s