gpt4 book ai didi

java - 使用Java代码启动oozie作业

转载 作者:行者123 更新时间:2023-12-02 21:56:36 25 4
gpt4 key购买 nike

我正在尝试使用javacode启动oozie作业,但无法执行相同操作。以下代码为几行代码提供了异常“unhandled type oozieClientException”

String jobId = wc.run(conf);

我是Java新手,正在寻求帮助。这是我的代码:
    OozieClient wc = new OozieClient("http://host.com:11000/oozie");

Properties conf = wc.createConfiguration();
conf.setProperty(....)
...
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));

最佳答案

您应该在try catch块中关闭代码

try{
OozieClient wc = new OozieClient("http://host.com:11000/oozie");

Properties conf = wc.createConfiguration();
conf.setProperty(....)
...
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();
}

OozieClientException-如果无法提交作业,则引发

关于java - 使用Java代码启动oozie作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12838615/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com