python - How do I choose a task_id using celery? -
For now I get task_id from async_result and save it to get it back later. It would be better if I knew what the work_id did, then I can calculate it back instead of pulling it from DB. Example: task_id = ("% s-% s"% (user_id, datetime))
.
You can definitely use "natural aids", but to be really useful They have to be reverse, which does not work when adding timestamps. Apart from that the IDs are also unique, so the two tasks can not have the same ID (then the behavior is undefined)
If you have a job of refreshing the Twitter user's timeline, then you know that you At any time you want to run a task for each user ID so that you can use a natural ID:
"update-twitter-timeline-% s"% (user_id) < / Code>
Then get results for that action Be able to, or cancel the work using that ID, no need to manually store it elsewhere.
Comments
Post a Comment