use of org.apache.oozie.service.JPAService in project oozie by apache.
the class TestPauseTransitService method testStart2.
/**
* Test : Start a PREP bundle when its kickoff time is a past time.
*
* @throws Exception
*/
public void testStart2() throws Exception {
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.PREP, false);
final JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
job.setKickoffTime(new Date(new Date().getTime() - 30 * 1000));
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_PAUSE_KICKOFF, job);
Runnable pauseStartRunnable = new PauseTransitRunnable();
pauseStartRunnable.run();
final String jobId = job.getId();
waitFor(10 * 1000, new Predicate() {
public boolean evaluate() throws Exception {
BundleJobBean job1 = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
return job1.getStatus() == Job.Status.RUNNING;
}
});
job = jpaService.execute(new BundleJobGetJPAExecutor(jobId));
assertEquals(Job.Status.RUNNING, job.getStatus());
}
use of org.apache.oozie.service.JPAService in project oozie by apache.
the class CoordActionReadyXCommand method loadState.
@Override
protected void loadState() throws CommandException {
jpaService = Services.get().get(JPAService.class);
if (jpaService == null) {
throw new CommandException(ErrorCode.E0610);
}
try {
coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB_ACTION_READY, jobId);
} catch (JPAExecutorException e) {
throw new CommandException(e);
}
LogUtils.setLogInfo(coordJob);
}
use of org.apache.oozie.service.JPAService in project oozie by apache.
the class CoordActionStartXCommand method loadState.
@Override
protected void loadState() throws CommandException {
jpaService = Services.get().get(JPAService.class);
try {
coordAction = jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionGetForStartJPAExecutor(actionId));
} catch (JPAExecutorException je) {
throw new CommandException(je);
}
LogUtils.setLogInfo(coordAction);
}
use of org.apache.oozie.service.JPAService in project oozie by apache.
the class CoordChangeXCommand method loadState.
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#loadState()
*/
@Override
protected void loadState() throws CommandException {
jpaService = Services.get().get(JPAService.class);
if (jpaService == null) {
throw new CommandException(ErrorCode.E0610);
}
try {
this.coordJob = jpaService.execute(new CoordJobGetJPAExecutor(jobId));
oldPauseTime = coordJob.getPauseTime();
prevStatus = coordJob.getStatus();
} catch (JPAExecutorException e) {
throw new CommandException(e);
}
LogUtils.setLogInfo(this.coordJob);
}
use of org.apache.oozie.service.JPAService in project oozie by apache.
the class BundleJobResumeXCommand method loadState.
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#loadState()
*/
@Override
protected void loadState() throws CommandException {
jpaService = Services.get().get(JPAService.class);
if (jpaService == null) {
throw new CommandException(ErrorCode.E0610);
}
try {
bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, bundleId);
bundleActions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, bundleId);
} catch (Exception Ex) {
throw new CommandException(ErrorCode.E0604, bundleId);
}
LogUtils.setLogInfo(bundleJob);
}
Aggregations