use of org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToCoordActionTableForWaiting.
protected CoordinatorActionBean addRecordToCoordActionTableForWaiting(String jobId, int actionNum, CoordinatorAction.Status status, String resourceXmlName, String missingDependencies, String pushMissingDependencies, String oozieTimeZoneMask) throws Exception {
CoordinatorActionBean action = createCoordAction(jobId, actionNum, status, resourceXmlName, 0, oozieTimeZoneMask, null);
action.setMissingDependencies(missingDependencies);
action.setPushMissingDependencies(pushMissingDependencies);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordActionInsertJPAExecutor coordActionInsertCmd = new CoordActionInsertJPAExecutor(action);
jpaService.execute(coordActionInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord action record to table");
throw je;
}
return action;
}
use of org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addCoordForBulkMonitor.
protected void addCoordForBulkMonitor(String bundleId) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
// adding coordinator job(s) for this bundle
addRecordToCoordJobTableWithBundle(bundleId, "Coord1", CoordinatorJob.Status.RUNNING, true, true, 2);
addRecordToCoordJobTableWithBundle(bundleId, "Coord2", CoordinatorJob.Status.RUNNING, true, true, 1);
addRecordToCoordJobTableWithBundle(bundleId, "Coord3", CoordinatorJob.Status.RUNNING, true, true, 1);
// adding coordinator action #1 to Coord#1
CoordinatorActionBean action1 = new CoordinatorActionBean();
action1.setId("Coord1@1");
action1.setStatus(CoordinatorAction.Status.FAILED);
action1.setCreatedTime(DateUtils.parseDateUTC(CREATE_TIME));
action1.setJobId("Coord1");
Calendar cal = Calendar.getInstance();
cal.setTime(DateUtils.parseDateUTC(CREATE_TIME));
cal.add(Calendar.DATE, -1);
action1.setNominalTime(cal.getTime());
CoordActionInsertJPAExecutor actionInsert = new CoordActionInsertJPAExecutor(action1);
jpaService.execute(actionInsert);
// adding coordinator action #2 to Coord#1
CoordinatorActionBean action2 = new CoordinatorActionBean();
action2.setId("Coord1@2");
action2.setStatus(CoordinatorAction.Status.KILLED);
action2.setCreatedTime(DateUtils.parseDateUTC(CREATE_TIME));
action2.setJobId("Coord1");
cal.setTime(DateUtils.parseDateUTC(CREATE_TIME));
cal.add(Calendar.DATE, -1);
action2.setNominalTime(cal.getTime());
actionInsert = new CoordActionInsertJPAExecutor(action2);
jpaService.execute(actionInsert);
// adding coordinator action #3 to Coord#2
CoordinatorActionBean action3 = new CoordinatorActionBean();
action3.setId("Coord2@1");
action3.setStatus(CoordinatorAction.Status.KILLED);
action3.setCreatedTime(DateUtils.parseDateUTC(CREATE_TIME));
action3.setJobId("Coord2");
cal.setTime(DateUtils.parseDateUTC(CREATE_TIME));
cal.add(Calendar.DATE, -1);
action3.setNominalTime(cal.getTime());
actionInsert = new CoordActionInsertJPAExecutor(action3);
jpaService.execute(actionInsert);
}
use of org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToCoordActionTable.
protected CoordinatorActionBean addRecordToCoordActionTable(CoordinatorActionBean action, String wfId) throws Exception {
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordActionInsertJPAExecutor coordActionInsertExecutor = new CoordActionInsertJPAExecutor(action);
jpaService.execute(coordActionInsertExecutor);
if (wfId != null) {
WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
wfJob.setParentId(action.getId());
WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_PARENT_MODIFIED, wfJob);
}
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord action record to table");
throw je;
}
return action;
}
use of org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor in project oozie by apache.
the class XDataTestCase method addRecordToCoordActionTable.
/**
* Insert coord action and workflow id as external id for testing.
*
* @param jobId coord job id
* @param actionNum action number
* @param status coord action status
* @param resourceXmlName xml file name
* @param wfId wf id
* @param wfStatus wf status
* @param pending pending counter
* @return coord action bean
* @throws Exception thrown if unable to create coord action bean
*/
protected CoordinatorActionBean addRecordToCoordActionTable(String jobId, int actionNum, CoordinatorAction.Status status, String resourceXmlName, String wfId, String wfStatus, int pending) throws Exception {
CoordinatorActionBean action = createCoordAction(jobId, actionNum, status, resourceXmlName, pending);
action.setExternalId(wfId);
action.setExternalStatus(wfStatus);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordActionInsertJPAExecutor coordActionInsertExecutor = new CoordActionInsertJPAExecutor(action);
jpaService.execute(coordActionInsertExecutor);
if (wfId != null) {
WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
wfJob.setParentId(action.getId());
WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_PARENT_MODIFIED, wfJob);
}
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord action record to table");
throw je;
}
return action;
}
Aggregations