use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class TestJsonToBean method testParseBulkResponse.
public void testParseBulkResponse() {
JSONObject json = createJsonBulkResponse();
BundleJob bulkBundle = JsonToBean.createBundleJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_BUNDLE));
CoordinatorJob bulkCoord = JsonToBean.createCoordinatorJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_COORDINATOR));
CoordinatorAction bulkAction = JsonToBean.createCoordinatorAction((JSONObject) json.get(JsonTags.BULK_RESPONSE_ACTION));
assertNotNull(bulkBundle);
assertNotNull(bulkCoord);
assertNotNull(bulkAction);
assertEquals("bundle-app", bulkBundle.getAppName());
assertEquals("bundle-id", bulkBundle.getId());
assertEquals(BundleJob.Status.RUNNING, bulkBundle.getStatus());
assertEquals("coord-app", bulkCoord.getAppName());
assertEquals(CoordinatorJob.Status.SUSPENDED, bulkCoord.getStatus());
assertEquals("action-id", bulkAction.getId());
assertEquals("coord-id", bulkAction.getJobId());
assertEquals(1, bulkAction.getActionNumber());
assertEquals("action-externalId", bulkAction.getExternalId());
assertEquals(CoordinatorAction.Status.FAILED, bulkAction.getStatus());
assertEquals("action-externalStatus", bulkAction.getExternalStatus());
assertEquals("action-errorCode", bulkAction.getErrorCode());
assertEquals("action-errorMessage", bulkAction.getErrorMessage());
assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), bulkAction.getCreatedTime());
assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), bulkAction.getNominalTime());
assertEquals("action-missingDeps", bulkAction.getMissingDependencies());
}
use of org.apache.oozie.client.CoordinatorJob in project oozie by apache.
the class OozieCLI method printBundleJob.
@VisibleForTesting
void printBundleJob(BundleJob bundleJob, String timeZoneId, boolean verbose) {
System.out.println("Job ID : " + bundleJob.getId());
System.out.println(RULER);
List<CoordinatorJob> coordinators = bundleJob.getCoordinators();
System.out.println("Job Name : " + maskIfNull(bundleJob.getAppName()));
System.out.println("App Path : " + maskIfNull(bundleJob.getAppPath()));
System.out.println("Status : " + bundleJob.getStatus());
System.out.println("Kickoff time : " + bundleJob.getKickoffTime());
System.out.println(RULER);
System.out.println(String.format(BUNDLE_COORD_JOBS_FORMATTER, "Job ID", "Status", "Freq", "Unit", "Started", "Next Materialized"));
System.out.println(RULER);
for (CoordinatorJob job : coordinators) {
System.out.println(String.format(BUNDLE_COORD_JOBS_FORMATTER, maskIfNull(job.getId()), job.getStatus(), job.getFrequency(), job.getTimeUnit(), maskDate(job.getStartTime(), timeZoneId, verbose), maskDate(job.getNextMaterializedTime(), timeZoneId, verbose)));
System.out.println(RULER);
}
}
use of org.apache.oozie.client.CoordinatorJob 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.client.CoordinatorJob 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.client.CoordinatorJob in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method getStatus.
private CoordinatorJob.Status getStatus(String jobId) {
CoordinatorJob job = null;
try {
JPAService jpaService = Services.get().get(JPAService.class);
job = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
} catch (JPAExecutorException se) {
se.printStackTrace();
}
return job.getStatus();
}
Aggregations