I keep trying to think of a way other than this:
And I really can’t think of a better way.
Especially if you are doing this (which I just read and think is a really great solution):
I would have a table with literally just one column of running ID’s.
- The ID’s would be added when the task was generated by another function before being passed back to the client.
- To do what you wanted I would do a
app_tables.running_btaskID_table.get(job_id)
for your job ID, if it wasNone
then your job is completed. - Finally if it is not
None
, to a.search()
on the table and test each running task withtask.is_running()
, deleting the rows of any that return False. - Finally Finally, repeat step 2 and return the result of if your task was still running.