Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

When scheduling tasks, is it possible to get the id of the Task database object that has been created? #6

Open
stargazer opened this issue Jul 16, 2012 · 2 comments

Comments

@stargazer
Copy link

When scheduling tasks, is it possible to get the id of the Task object that has been created in the database? That would be really useful, since it would enable us to cancel the scheduled task, simply by deleting the object.

@lilspikey
Copy link
Owner

It's not currently possible (it's currently fire and forget). I'll look into returning an object that would let you get the id when you schedule a task (currently None is returned).

@lilspikey
Copy link
Owner

One things that occurs to me about this is being careful not to delete a task that's actually in the process of being run. We'd probably need to lock the task (in the same manner as the worker process) before deleting to avoid this issue. Plus we'd need to report back whether the deletion was successful or not. For tasks scheduled in the future it should always work, but there is the edge case of tasks that are getting cancelled just as they are about to run...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants