Question

Is there a simple way to make mrJob scripts interruptable? Pretty simple question, but it makes a big difference for debugging. I'm mainly interested in canceling python-only test jobs, because this is where most debugging happens.

python my_mr_script.py my-mr-input.txt
Was it helpful?

Solution

You've got a few easy options:

  • Send SIGQUIT (that's ctrl-\ in your terminal). Most processes don't bother catching SIGQUIT, so it's one strategy to deal with something that has a less-than-awesome SIGINT (aka ctrl-c) handler.
  • ctrl-z + kill -9 %1 - aka, the nuclear option. Even more rare than catching SIGQUIT is catching SIGTSTP. That's what your shell uses to do job control. In this case you're suspending the job and then sending it SIGKILL, which it cannot catch.

N.b. that the %1 above is a bash-ism and it assumes this is the only job running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top