How to delete an enqueued job? #127
-
|
I'd like to be able to delete a enqueued job, based on args. And then delete it using the queue and args to find it: Is this possible? ChatGPT says it's possible but I need the Is there a way to do this? Or perhaps a way to get the jobId based on the args? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Hey @drewbaker. You cannot directly delete a job based on its args, but you can fetch the jobs: Sidequest.job.list()There you can pass args and class name as params, and you will get a list of jobs. You find yours, get the ID, and then delete the job by ID. |
Beta Was this translation helpful? Give feedback.
-
|
Is there a way to list jobs that contain some of the args, rather than exact match of all args? For example, Job args: So I'd want to search all jobs for Sorry if there are docs anywhere for this, I couldn't find them. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, list expects an exact match of args. There is no way of doing partial matches. |
Beta Was this translation helpful? Give feedback.
After that, you can do:
This won't actually delete the job, just cancel it and prevent its execution, or abort it if it's running.
Then it's considered a completed job, thus it will be cleaned based on your cleanup config.
In hindsight, we should have done a delete function, but that would require some lifecycle assertions to do it.