rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
611 stars 71 forks source link

Discard jobs that are in progress #180

Closed salmonsteak1 closed 1 month ago

salmonsteak1 commented 1 month ago

Hi, is there any way for us to stop/discard a job that is in progress by a worker? I was looking to do this in the event that there's some problematic jobs that requires manual intervention, and I was thinking to do this through the console helpers. Right now, when I run:

ActiveJob.jobs.in_progress.where(worker_id: 675).discard_all

It gives a UndiscardableError, "Can't discard jobs in progress" error

rosa commented 1 month ago

Hey @salmonsteak1, this is not yet supported directly from Mission Control, but it'll be for version 1.0. There's some more info here: https://github.com/rails/solid_queue/issues/124#issue-2080892576 In general you can't stop a single job that's already in progress, you'd need to force the worker running it to quit, which would also interrupt any other jobs if you're running more than one thread. In Mission Control you can get information about the worker running a specific job (the host, the PID...) so you can send a QUIT signal to it.

salmonsteak1 commented 1 month ago

Hey, thanks for the quick reply @rosa! Will close the issue