本文整理汇总了Java中org.apache.oozie.client.WorkflowJob类的典型用法代码示例。如果您正苦于以下问题:Java WorkflowJob类的具体用法?Java WorkflowJob怎么用?Java WorkflowJob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorkflowJob类属于org.apache.oozie.client包,在下文中一共展示了WorkflowJob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitForWorkflow
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
ExternalId extId = new ExternalId(processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
OozieClient ozClient = OozieClientFactory.get(
(Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
String jobId = ozClient.getJobId(extId.getId());
WorkflowJob jobInfo = null;
for (int i = 0; i < 15; i++) {
jobInfo = ozClient.getJobInfo(jobId);
if (jobInfo.getStatus() == status) {
break;
}
System.out.println("Waiting for workflow job " + jobId + " status " + status);
Thread.sleep((i + 1) * 1000);
}
Assert.assertEquals(status, jobInfo.getStatus());
}
示例2: setWorkflowjob
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
/**
* Copy WorkflowJob information in OOZIE to Oozie we defined
* @param job WorkflowJob
* @return OozieJob
*/
public static OozieJob setWorkflowjob(WorkflowJob job) {
OozieJob oozieJob = new OozieJob();
oozieJob.setAcl(job.getAcl());
for (WorkflowAction temp : job.getActions()) {
OozieAction a = asAction(temp, job.getId() );
oozieJob.addAction(a);
}
oozieJob.setAppName(job.getAppName());
oozieJob.setAppPath(job.getAppPath());
oozieJob.setConf(job.getConf());
oozieJob.setConsoleUrl(job.getConsoleUrl());
oozieJob.setCreatedTime(job.getCreatedTime());
oozieJob.setEndTime(job.getEndTime());
oozieJob.setExternalId(job.getExternalId());
oozieJob.setGroup(job.getGroup());
oozieJob.setId(job.getId());
oozieJob.setLastModifiedTime(job.getLastModifiedTime());
oozieJob.setParentId(job.getParentId());
oozieJob.setRun(job.getRun());
oozieJob.setStartTime(job.getStartTime());
oozieJob.setStatus(job.getStatus().toString());
oozieJob.setUser(job.getUser());
return oozieJob;
}
示例3: testOozie
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
@Test
public void testOozie() throws Exception {
Properties properties = new Properties();
properties.load(JavaActionTest.class.getClassLoader().getResourceAsStream("java-action-test/job.properties"));
properties.setProperty("nameNode", hdfsUnit.getNamenode());
properties.setProperty("jobTracker", yarnUnit.getJobTracker());
workflowPath = properties.getProperty("appPath");
deployWorkflow(properties);
prepareJavaAction(properties);
OozieJob oozieJob = oozieUnit.run(properties);
oozieJob.waitFinish(TimeUnit.MINUTES.toMillis(15));
Assert.assertEquals(WorkflowJob.Status.SUCCEEDED, oozieJob.getWorkflowJob().getStatus());
checkJavaAction(properties);
}
示例4: testOozie
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
@Test
public void testOozie() throws Exception {
Assume.assumeTrue(Hive2Unit.VERSION.compareTo(new Version("0.14.0")) >= 0);
Properties properties = new Properties();
properties.load(OozieUnitTest.class.getClassLoader().getResourceAsStream("job.properties"));
properties.setProperty("nameNode", hdfsUnit.getNamenode());
properties.setProperty("jobTracker", yarnUnit.getJobTracker());
workflowPath = properties.getProperty("appPath");
deployWorkflow(properties);
prepareJavaAction(properties);
prepareMapredAction(properties);
prepareHiveAction(properties);
preparePigAction(properties);
prepareShellAction(properties);
OozieJob oozieJob = oozieUnit.run(properties);
oozieJob.waitFinish(TimeUnit.MINUTES.toMillis(15));
Assert.assertEquals(WorkflowJob.Status.SUCCEEDED, oozieJob.getWorkflowJob().getStatus());
checkJavaAction(properties);
checkMapredAction(properties);
checkHive2Action(properties);
checkPigAction(properties);
checkShellAction(properties);
}
示例5: getWorkflowJob
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
public WorkflowJob getWorkflowJob() throws OozieException {
try {
return oozieClient.getJobInfo(jobId);
} catch (OozieClientException e) {
throw new OozieException(e);
}
}
示例6: testReRunInstances
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
public void testReRunInstances() throws Exception {
testKillInstances();
InstancesResult response = this.service.path("api/instance/rerun/process/" + processName)
.queryParam("start", START_INSTANCE).header("Remote-User", "guest").accept(MediaType.APPLICATION_JSON)
.post(InstancesResult.class);
Assert.assertEquals(APIResult.Status.SUCCEEDED, response.getStatus());
Assert.assertNotNull(response.getInstances());
Assert.assertEquals(1, response.getInstances().length);
assertInstance(response.getInstances()[0], START_INSTANCE, WorkflowStatus.RUNNING);
waitForWorkflow(START_INSTANCE, WorkflowJob.Status.RUNNING);
}
示例7: testKillInstances
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
public void testKillInstances() throws Exception {
schedule();
InstancesResult response = this.service.path("api/instance/kill/process/" + processName)
.queryParam("start", START_INSTANCE).header("Remote-User", "guest").accept(MediaType.APPLICATION_JSON)
.post(InstancesResult.class);
Assert.assertEquals(APIResult.Status.SUCCEEDED, response.getStatus());
Assert.assertNotNull(response.getInstances());
Assert.assertEquals(1, response.getInstances().length);
assertInstance(response.getInstances()[0], START_INSTANCE, WorkflowStatus.KILLED);
waitForWorkflow(START_INSTANCE, WorkflowJob.Status.KILLED);
}
示例8: testSuspendInstances
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
public void testSuspendInstances() throws Exception {
schedule();
InstancesResult response = this.service.path("api/instance/suspend/process/" + processName)
.queryParam("start", START_INSTANCE).header("Remote-User", "guest").accept(MediaType.APPLICATION_JSON)
.post(InstancesResult.class);
Assert.assertEquals(APIResult.Status.SUCCEEDED, response.getStatus());
Assert.assertNotNull(response.getInstances());
Assert.assertEquals(1, response.getInstances().length);
assertInstance(response.getInstances()[0], START_INSTANCE, WorkflowStatus.SUSPENDED);
waitForWorkflow(START_INSTANCE, WorkflowJob.Status.SUSPENDED);
}
示例9: testResumesInstances
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
public void testResumesInstances() throws Exception {
testSuspendInstances();
InstancesResult response = this.service.path("api/instance/resume/process/" + processName)
.queryParam("start", START_INSTANCE).header("Remote-User", "guest").accept(MediaType.APPLICATION_JSON)
.post(InstancesResult.class);
Assert.assertEquals(APIResult.Status.SUCCEEDED, response.getStatus());
Assert.assertNotNull(response.getInstances());
Assert.assertEquals(1, response.getInstances().length);
assertInstance(response.getInstances()[0], START_INSTANCE, WorkflowStatus.RUNNING);
waitForWorkflow(START_INSTANCE, WorkflowJob.Status.RUNNING);
}
示例10: waitForWorkflow
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
ExternalId extId = new ExternalId(processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
OozieClient ozClient = OozieClientFactory.get((Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
String jobId = ozClient.getJobId(extId.getId());
WorkflowJob jobInfo = null;
for (int i = 0; i < 15; i++) {
jobInfo = ozClient.getJobInfo(jobId);
if (jobInfo.getStatus() == status)
break;
System.out.println("Waiting for workflow job " + jobId + " status " + status);
Thread.sleep((i + 1) * 1000);
}
Assert.assertEquals(status, jobInfo.getStatus());
}
示例11: getRunningJobs
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
private List<WorkflowJob> getRunningJobs(String entityName) throws Exception {
OozieClient ozClient = OozieClientFactory.get((Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
StringBuilder builder = new StringBuilder();
builder.append(OozieClient.FILTER_STATUS).append('=').append(Job.Status.RUNNING).append(';');
builder.append(OozieClient.FILTER_NAME).append('=').append("IVORY_PROCESS_DEFAULT_").append(entityName);
return ozClient.getJobsInfo(builder.toString());
}
示例12: waitForWorkflowStart
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
protected void waitForWorkflowStart(String entityName) throws Exception {
for (int i = 0; i < 25; i++) {
List<WorkflowJob> jobs = getRunningJobs(entityName);
if (jobs != null && !jobs.isEmpty())
return;
System.out.println("Waiting for workflow to start");
Thread.sleep(i * 1000);
}
throw new Exception("Workflow for " + entityName + " hasn't started in oozie");
}
示例13: testLogMover
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
@Test
public void testLogMover() throws Exception {
CurrentUser.authenticate(System.getProperty("user.name"));
OozieWorkflowEngine engine = new OozieWorkflowEngine();
engine.schedule(testProcess);
OozieClient client = new OozieClient(
ClusterHelper.getOozieUrl(testCluster.getCluster()));
List<WorkflowJob> jobs;
while (true) {
jobs = client.getJobsInfo(OozieClient.FILTER_NAME + "="
+ "IVORY_PROCESS_DEFAULT_" + processName);
if (jobs.size() > 0) {
break;
} else {
Thread.sleep(100);
}
}
WorkflowJob job = jobs.get(0);
while (true) {
if (!(job.getStatus() == WorkflowJob.Status.RUNNING || job
.getStatus() == WorkflowJob.Status.PREP)) {
break;
} else {
Thread.sleep(100);
job = client.getJobInfo(job.getId());
}
}
Path oozieLogPath = new Path(getLogPath(),
"job-2010-01-01-01-00/000/oozie.log");
Assert.assertTrue(fs.exists(oozieLogPath));
testLogMoverWithNextRunId(job.getId());
}
示例14: getJobInfo
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
@Override
public WorkflowJob getJobInfo(String jobId, int start, int len)
throws OozieClientException {
synchronized (lock) {
return client.getJobInfo(jobId, start, len);
}
}
示例15: getJobsInfo
import org.apache.oozie.client.WorkflowJob; //导入依赖的package包/类
@Override
public List<WorkflowJob> getJobsInfo(String filter, int start, int len)
throws OozieClientException {
synchronized (lock) {
return client.getJobsInfo(filter, start, len);
}
}