views:

47

answers:

1

For now I get a task_id from the async_result and have to save it the get it back later. Would be better if I knew what the task_id what made of so I can calculate it back instead of pulling from the DB. E.G: set a task with task_id=("%s-%s" % (user_id, datetime)).

+1  A: 

You can certainly use "natural ids", but then to be really useful they would have to be reverseable, which doesn't work if you add that timestamp. Also the ids are unique, so two tasks can't have the same id (the behavior then is undefined)

If you have a task to refresh the timeline of a twitter user, then you know that you only want one task running for each user id at any time, so you could use a natural id like:

"update-twitter-timeline-%s" % (user_id)

then always be able to get the result for that task, or revoke the task using that id, no need to manually store it somewhere and look it up.

asksol