Search code examples
apache-sparkoozieoozie-coordinatoroozie-workflow

Killing oozie coordinator is not killing the subsequent spark job


When i tried to kill a spark job which is invoked from an oozie job it's not getting killed. It's just showing the workflow job is killed. Then i checked the workflow log from this command

oozie job --ozie oozieurl -log workflowID

it shows this error in the logs.

org.apache.oozie.command.CommandException: E0800: Action it is not running its in [KILLED] state, action [0006849-180819131048313-oozie-oozi-W@MysparkApplication]
        at org.apache.oozie.command.wf.CompletedActionXCommand.eagerVerifyPrecondition(CompletedActionXCommand.java:92)
        at org.apache.oozie.command.XCommand.call(XCommand.java:258)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:178)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Am i doing something wrong or is it a limitation that we can not kill spark application which is started in yarn from oozie coordinator.


Solution

  • Oozie coordinator runs an oozie workflow with a particular schedule. When the coordinator invokes the oozie workflow it submits the spark job on the cluster.

    Here the coordinator and the oozie workflow only does the tracking of the job, i.e. whether the job is running or killed etc.

    Now if you kill the oozie workflow or the coordinator it ensures the next step in the workflow is not getting invoked. However it doesn't touch the existing spark job. This is by design.

    If you want to kill the spark job you need to kill the spark job manually in the cluster using the following command

    yarn application -kill <applicationId>