Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to kill a job running inside a worker process? #1459

Closed
runlevel5 opened this issue Feb 4, 2014 · 3 comments
Closed

How to kill a job running inside a worker process? #1459

runlevel5 opened this issue Feb 4, 2014 · 3 comments

Comments

@runlevel5
Copy link
Contributor

@mperham explained to me that you could not kill a thread in a worker process as it is quite dangerous. However for my usecase, I need total control on job killing. I am thinking of running multiple workers each with 1 thread, so I could kill the PID instead. It does come with a resource cost though. And then @mperham suggested this: "or have the worker thread check if should it halt". I don't truly understand what does it mean, this ticket is dedicated for explanation on that

@mperham
Copy link
Collaborator

mperham commented Feb 4, 2014

Can you explain the job your worker is performing? At a high level, I'm speaking something like this:

def perform
  while active? && !done
    do_something
  end
end

The active? check could verify the job has not been cancelled. That's the point of the JID: it's a global identifier you can use to power this type of thing.

@runlevel5
Copy link
Contributor Author

@mperham I think you misunderstand me. In my use case, some job takes too long and I could not figure out how to kill a single job (which is probably running in a thread)

@mperham
Copy link
Collaborator

mperham commented Feb 4, 2014

You cannot stop a job that is taking too long. The only thing you can do is shut down the Sidekiq process and restart it.

@mperham mperham closed this as completed Feb 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants