0

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
Abe
  • 22,738
  • 26
  • 82
  • 111
  • Shooting from the hip: try ctrl-\ (aka SIGQUIT). – Dave S. Apr 25 '13 at 18:11
  • Works on my mac. Nice! It does open a dialog that says "Python quit unexpectedly." and asks me to report the error. Minor pain, but not nearly as bad as waiting 10 minutes for a buggy script to finish. – Abe Apr 25 '13 at 18:12
  • 1
    Cool! I will expand this into a proper answer. – Dave S. Apr 25 '13 at 18:16

1 Answers1

1

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.

Dave S.
  • 6,349
  • 31
  • 33