How to get notified on job success/failure or check running job status? #319
-
I'm working on system where some jobs depend on other jobs, I want to queue one or more jobs, wait for them to complete, then queue one or more other jobs in response. I'm using the postgres storage as well. Is there a supported way to check the status of a queued/running job? I was planning to build a simple task that would poll for the job, check the status, and sleep if it was still pending, but I can't find anywhere in the API that will let me check the status of a job. Storage::fetch_by_id looks like what I want but I don't see how to actually get the status of the job from the returned Request or Job, maybe I'm just missing it. Alternatively I can always just query the apalis.jobs table directly and check the status column, but I was hoping to find a way supported in the programmatic API. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think this is a case where you might want to do the query yourself. |
Beta Was this translation helpful? Give feedback.
-
Also you can use let ctx: SqlContext = req.data().unwrap(): The context contains a state which tells you the state of the job. |
Beta Was this translation helpful? Give feedback.
Also you can use
fetch_by_id
. It will returnRequest
which had a data entry forSqlContext
.The context contains a state which tells you the state of the job.