How to kill adoop job gracefully / intercept `hadoop job -kill`

My Java application runs on mapper and creates child processes using the Qubole API. The application stores child quoble queryIDs. I need to intercept the kill signal and close the child processes before exiting. hadoop job -kill jobId and yarn application -kill applicationId commands kill the job in SIGKILL mode, I don’t know how to intercept the shutdown. Is there any way to intercept the destruction of a job or configure hadoop so that the application can shut down correctly?

The application successfully intercepts shutdown with ShutdownHook at local launch, and not in the mapper container, and can terminate its child processes.

Please tell me how to intercept the shutdown when working in the mapper, or maybe I'm doing something wrong?

+6
java mapreduce hadoop qubole
source share
1 answer

SIGKILL does not stop, and no process can catch it. Neither your Java application nor the JVM itself ... This is, in fact, not an event dispatched to a process. Consider it rather as a direct order of the kernel, so that without any problems to destroy all the resources of the process.

From man 7 signal :

SIGKILL and SIGSTOP signals cannot be caught, blocked, or ignored.

This is a built-in function of the kernel core; you cannot get around it.

Also note that according to Prabhu (2015-07-15) on how to kill hadoop missions :

Using the following command depreciates

 hadoop job -list hadoop job -kill $jobId 

consider using

 mapred job -list mapred job -kill $jobId 

This is confirmed by Apache Hadoop - legacy API documentation

Unfortunately, according to the current mapred Documentation , you cannot control the type of signal sent to complete the job.

+2
source share

All Articles