Hi,
I am submitting a Hadoop M/R job using OOZIE java client API. But, the job
seems running continuously without stopping. It ran for quite some time,
and ended prematurely throwing an exception of “Optimistic Lock”. Can you
please help?
Below is the code:
package com.example.oozie.client;
import org.apache.oozie.client.OozieClient;import
org.apache.oozie.client.OozieClientException;import
org.apache.oozie.client.WorkflowJob;
import java.util.Properties;
public class OozieClientDemo {
public static void main(String[] args) throws
OozieClientException,
InterruptedException { OozieClient wc = new
OozieClient("http://localhost:11000/oozie/");
Properties conf = wc.createConfiguration();
conf.setProperty(OozieClient.APP_PATH,
"hdfs://localhost:8020/user/root/examples/apps/map-reduce/workflow.xml");
conf.setProperty("jobTracker", "localhost:8021");
conf.setProperty("nameNode",
"hdfs://localhost:8020");
conf.setProperty("inputDir", "/oozie/inputdir");
conf.setProperty("outputDir", "/oozie/outputdir");
String jobId = wc.run(conf);
System.out.println("Work flow submitted");
while (wc.getJobInfo(jobId).getStatus() ==
WorkflowJob.Status.RUNNING) {
System.out.println("Workflow job
running..."); Thread.sleep(10 *
1000); }
System.out.println("Workflow job
completed");
System.out.println(wc.getJobInfo(jobId));
}
}
Regards,
Shouvanik