0

Suppose we have a MapReduce job and we would like termination/killing of the job to be baked into our Java MapReduce-- say after a specific range of time, how do i go about doing that?

for instance, kill the job after a specified period of time

Don U
  • 47
  • 1
  • 10

2 Answers2

1

You can get the Job using job ID and then use Job.killJob()

Jijo
  • 611
  • 5
  • 18
  • `java.lang.Exception: java.lang.IllegalStateException: Job in state DEFINE instead of RUNNING` when i use job.killJob(), i'm getting this error message printed on my log. Do you know why is it so? – iamprem Oct 24 '15 at 01:10
  • It is because you are trying to kill the job even before it has started. The job has to be in the `RUNNING` state to be killed. during the DEFINE state the job is starting to run(ie the time taken to identify the blocks that are to be processed and the metadata processing needed to process the job) – Jijo Oct 26 '15 at 09:22
0

You could set a simple timer using Thread.sleep() and then use Job.killJob() to kill the job.

itzhaki
  • 822
  • 2
  • 7
  • 19