문제

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
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top