我正在尝试使用java代码启动oozie操作。当使用命令行时,我们通过“-config job.properties”指定属性文件,它知道选择哪个工作流。如何在java代码中定义“job.properties”文件来执行相同的任务?
conf.setProperty(OozieClient.APP_PATH,"hdfs://clusterdb05.com:8020/user/apps/merge-logs/workflow.xml");
conf.setProperty("jobTracker", "jobtracker.com:8021");
conf.setProperty("nameNode", "hdfs://namenode.com:8020");
conf.setProperty("queueName", "jobtracker.com:8021");
conf.setProperty("appsRoot", "hdfs://namenode.com:8020/user/apps");
try {
String jobId = wc.run(conf);
System.out.println("Workflow job 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));
} catch (OozieClientException oozieClientException) {
oozieClientException.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
1条答案
按热度按时间jaxagkaj1#
这是一个很好的例子
ResourceBundel
. 试着与你的程序整合。作业属性
输出: