PolicyStat / jobtastic

Make your user-responsive long-running Celery jobs totally awesomer.
http://policystat.github.com/jobtastic/
MIT License
645 stars 61 forks source link

task_id from within calculate_result #42

Closed sandroden closed 10 years ago

sandroden commented 10 years ago

Is there a way to get the task_id from within calculate_result?

winhamwr commented 10 years ago

Hello Sandro,

I don't think Jobtastic changes that behavior, but there are two ways to get the ID:

In celery 2.2 and higher, you use the context, so self.request.id. In older versions, you can just grab the task_id keyword argument that will be passed along to run and then to calculate_result.

Let me know if that doesn't work for you.

Thanks -Wes

sandroden commented 10 years ago

Yes,it did indeed. Thanks a lot!

sandro