use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestFutureActionsTimeOut method _testTimeout.
/**
* The catch-up mode time up has been setup in {@link CoordActionMaterializeXCommand}
* @param jobId job id
* @param createDate create date
* @throws Exception thrown if failed
*/
private void _testTimeout(final String jobId, Date createDate) throws Exception {
final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
waitFor(12000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorJob job = ce.getCoordJob(jobId);
return !(job.getStatus().equals(CoordinatorJob.Status.PREP));
}
});
CoordinatorJob job = ce.getCoordJob(jobId);
assertTrue(!(job.getStatus().equals(CoordinatorJob.Status.PREP)));
waitFor(12000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorJob job = ce.getCoordJob(jobId);
List<CoordinatorAction> actions = job.getActions();
return actions.size() > 0;
}
});
job = ce.getCoordJob(jobId);
List<CoordinatorAction> actions = job.getActions();
assertTrue(actions.size() > 0);
for (CoordinatorAction action : actions) {
CoordinatorActionBean jsonAction = (CoordinatorActionBean) action;
if (jsonAction.getNominalTime().before(createDate)) {
assertEquals(10, jsonAction.getTimeOut());
} else {
assertEquals(10, jsonAction.getTimeOut());
}
}
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestPastActionsTimeOut method _testTimeout.
/**
* The catch-up mode time up has been setup in {@link CoordActionMaterializeXCommand}
* @param jobId job id
* @throws Exception thrown if failed
*/
private void _testTimeout(final String jobId) throws Exception {
final CoordinatorEngine ce = new CoordinatorEngine(getTestUser());
waitFor(6000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorJob job = ce.getCoordJob(jobId);
return !(job.getStatus().equals(CoordinatorJob.Status.PREP));
}
});
CoordinatorJob job = ce.getCoordJob(jobId);
assertTrue(!(job.getStatus().equals(CoordinatorJob.Status.PREP)));
waitFor(6000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorJob job = ce.getCoordJob(jobId);
List<CoordinatorAction> actions = job.getActions();
return actions.size() > 0;
}
});
job = ce.getCoordJob(jobId);
List<CoordinatorAction> actions = job.getActions();
assertTrue(actions.size() > 0);
for (CoordinatorAction action : actions) {
CoordinatorActionBean json = (CoordinatorActionBean) action;
assertEquals(10, json.getTimeOut());
}
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordRerunXCommand method testCoordRerunDate1.
/**
* Test : rerun <jobId> -date 2009-12-15T17:00Z -nocleanup
*
* @throws Exception
*/
public void testCoordRerunDate1() throws Exception {
final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C";
final int actionNum = 1;
final String actionId = jobId + "@" + actionNum;
try {
addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action1.xml");
} catch (Exception e) {
e.printStackTrace();
fail("Could not update db.");
}
CoordinatorActionBean action1 = getCoordinatorAction(actionId);
assertEquals(action1.getStatus(), CoordinatorAction.Status.SUCCEEDED);
final OozieClient coordClient = LocalOozie.getCoordClient();
coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_DATE, "2009-12-15T01:00Z", false, true);
CoordinatorActionBean action2 = getCoordinatorAction(actionId);
assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordRerunXCommand method testCoordRerunCleanupNoOutputEvents.
/**
* Test : rerun <jobId> -action 1 with no output-event
*
* @throws Exception
*/
public void testCoordRerunCleanupNoOutputEvents() throws Exception {
final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C";
final int actionNum = 1;
final String actionId = jobId + "@" + actionNum;
try {
addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action3.xml");
} catch (Exception e) {
e.printStackTrace();
fail("Could not update db.");
}
final OozieClient coordClient = LocalOozie.getCoordClient();
coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false, false);
CoordinatorActionBean action2 = getCoordinatorAction(actionId);
assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
waitFor(120 * 1000, new Predicate() {
@Override
public boolean evaluate() throws Exception {
CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
return (bean.getStatus() == CoordinatorAction.Status.WAITING || bean.getStatus() == CoordinatorAction.Status.READY);
}
});
CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
assertTrue(bean.getStatus() == CoordinatorAction.Status.WAITING || bean.getStatus() == CoordinatorAction.Status.READY);
}
use of org.apache.oozie.CoordinatorActionBean in project oozie by apache.
the class TestCoordRerunXCommand method testCoordRerunCleanupOption.
/**
* Test : nocleanup option in dataset
*
* @throws Exception
*/
public void testCoordRerunCleanupOption() throws Exception {
final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C";
final int actionNum = 1;
final String actionId = jobId + "@" + actionNum;
try {
addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.SUCCEEDED, "coord-rerun-action4.xml");
} catch (Exception e) {
e.printStackTrace();
fail("Could not update db.");
}
Path appPath = new Path(getFsTestCaseDir(), "coord");
String outputDir = appPath.toString() + "/coord-input/2009/12/14/11/00";
Path success = new Path(outputDir, "_SUCCESS");
FileSystem fs = getFileSystem();
fs.mkdirs(new Path(outputDir));
fs.create(success, true);
// before cleanup
assertTrue(fs.exists(success));
long beforeModifiedTime = fs.getFileStatus(success).getModificationTime();
final OozieClient coordClient = LocalOozie.getCoordClient();
coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false, false);
CoordinatorActionBean action2 = getCoordinatorAction(actionId);
assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
waitFor(120 * 1000, new Predicate() {
@Override
public boolean evaluate() throws Exception {
CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
return (bean.getStatus() == CoordinatorAction.Status.WAITING || bean.getStatus() == CoordinatorAction.Status.READY);
}
});
// after cleanup
assertTrue(fs.exists(success));
long afterModifiedTime = fs.getFileStatus(success).getModificationTime();
assertEquals(beforeModifiedTime, afterModifiedTime);
}
Aggregations