use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestCoordinatorEngine method testCustomDoneFlag.
/**
* Test Missing Dependencies with Done Flag in Schema
*
* @throws Exception
*/
public void testCustomDoneFlag() throws Exception {
Configuration conf = new XConfiguration();
String appPath = getTestCaseFileUri("coordinator.xml");
String appXml = "<coordinator-app name=\"NAME\" frequency=\"${coord:days(1)}\" start=\"2009-02-01T01:00Z\" end=" + "\"2009-02-01T02:00Z\" timezone=\"UTC\" " + "xmlns=\"uri:oozie:coordinator:0.1\"> <controls> <timeout>10</timeout> <concurrency>2</concurrency> " + "<execution>LIFO</execution> </controls> <datasets> " + "<dataset name=\"local_a\" frequency=\"${coord:days(1)}\" initial-instance=\"2009-02-01T01:00Z\" " + "timezone=\"UTC\"> <uri-template>" + getTestCaseFileUri("workflows/${YEAR}/${MONTH}/${DAY}") + "</uri-template> " + "<done-flag>consume_me</done-flag> </dataset>" + "</datasets> <input-events> " + "<data-in name=\"A\" dataset=\"local_a\"> <instance>${coord:current(0)}</instance> </data-in> " + "</input-events> " + "<action> <workflow> <app-path>hdfs:///tmp/workflows2/</app-path> " + "<configuration> <property> <name>inputA</name> <value>${coord:dataIn('A')}</value> </property> " + "</configuration> </workflow> </action> </coordinator-app>";
writeToFile(appXml, appPath);
conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
conf.set(OozieClient.USER_NAME, getTestUser());
final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
final String jobId = ce.submitJob(conf, true);
waitFor(5000, new Predicate() {
public boolean evaluate() throws Exception {
try {
List<CoordinatorAction> actions = ce.getCoordJob(jobId).getActions();
for (CoordinatorAction action : actions) {
CoordinatorAction.Status actionStatus = action.getStatus();
if (actionStatus == CoordinatorAction.Status.WAITING) {
return true;
}
}
} catch (Exception ex) {
return false;
}
return false;
}
});
List<CoordinatorAction> actions = ce.getCoordJob(jobId).getActions();
assertTrue(actions.size() > 0);
CoordinatorAction action = actions.get(0);
String missingDeps = action.getMissingDependencies();
System.out.println("..Missing deps=" + missingDeps);
assertEquals(new URI(getTestCaseFileUri("workflows/2009/02/01/consume_me")), new URI(missingDeps));
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestCoordInputLogicPush method startCoordAction.
private void startCoordAction(final String jobId) throws CommandException, JPAExecutorException {
new CoordMaterializeTransitionXCommand(jobId, 3600).call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
new CoordPushDependencyCheckXCommand(jobId + "@1").call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
}
});
CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
assertFalse("Action status should not be waiting", actionBean.getStatus().equals(CoordinatorAction.Status.WAITING));
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.READY);
}
});
CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestCoordinatorInputLogic method startCoordAction.
private void startCoordAction(final String jobId, final CoordinatorAction.Status coordActionStatus) throws CommandException, JPAExecutorException {
new CoordMaterializeTransitionXCommand(jobId, 3600).call();
new CoordActionInputCheckXCommand(jobId + "@1", jobId).call();
waitFor(50 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorActionBean actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
return !actionBean.getStatus().equals(CoordinatorAction.Status.WAITING);
}
});
CoordinatorAction actionBean = CoordActionQueryExecutor.getInstance().get(CoordActionQuery.GET_COORD_ACTION, jobId + "@1");
assertFalse(actionBean.getStatus().equals(coordActionStatus));
CoordinatorJob coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, jobId);
new CoordActionStartXCommand(actionBean.getId(), coordJob.getUser(), coordJob.getAppName(), actionBean.getJobId()).call();
}
Aggregations