use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class BundleJobChangeXCommand method loadState.
@Override
protected void loadState() throws CommandException {
try {
this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB, bundleJob.getId());
this.bundleActions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE, bundleJob.getId());
} catch (JPAExecutorException Ex) {
throw new CommandException(ErrorCode.E1311, this.jobId);
}
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class BundleJobChangeXCommand method eagerLoadState.
@Override
protected void eagerLoadState() throws CommandException {
try {
this.bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_STATUS, jobId);
LogUtils.setLogInfo(bundleJob);
} catch (JPAExecutorException ex) {
throw new CommandException(ex);
}
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class BundleKillXCommand method updateBundleAction.
/**
* Update bundle action
*
* @param action
* @throws CommandException
*/
private void updateBundleAction(BundleActionBean action) {
action.setLastModifiedTime(new Date());
if (!action.isTerminalStatus()) {
action.incrementAndGetPending();
action.setStatus(Job.Status.KILLED);
} else {
// while coordinator is killed.
if (action.isPending()) {
if (action.getCoordId() == null) {
action.setPending(0);
} else {
try {
CoordinatorJobBean coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, action.getCoordId());
if (!coordJob.isPending() && coordJob.isTerminalStatus()) {
action.setPending(0);
action.setStatus(coordJob.getStatus());
}
} catch (JPAExecutorException e) {
LOG.warn("Error in checking coord job status:" + action.getCoordId(), e);
}
}
}
}
updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class BundleStatusTransitXCommand method loadState.
@Override
protected void loadState() throws CommandException {
try {
bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MOD_PAUSE_SUSPEND_TIME, jobId);
bundleActions = BundleActionQueryExecutor.getInstance().getList(BundleActionQuery.GET_BUNDLE_UNIGNORED_ACTION_STATUS_PENDING_FOR_BUNDLE, jobId);
for (BundleActionBean bAction : bundleActions) {
int counter = 0;
if (bundleActionStatus.containsKey(bAction.getStatus())) {
counter = getActionStatusCount(bAction.getStatus()) + 1;
} else {
++counter;
}
bundleActionStatus.put(bAction.getStatus(), counter);
if (bAction.getCoordId() == null && (bAction.getStatus() == Job.Status.FAILED || bAction.getStatus() == Job.Status.KILLED)) {
new BundleKillXCommand(jobId).call();
bundleJob = BundleJobQueryExecutor.getInstance().get(BundleJobQuery.GET_BUNDLE_JOB_ID_STATUS_PENDING_MOD_PAUSE_SUSPEND_TIME, jobId);
bundleJob.setStatus(Job.Status.FAILED);
bundleJob.setLastModifiedTime(new Date());
BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS, bundleJob);
}
if (bAction.isPending()) {
LOG.debug(bAction + " has pending flag set");
foundPending = true;
}
}
LogUtils.setLogInfo(bundleJob);
} catch (JPAExecutorException e) {
throw new CommandException(ErrorCode.E1322, e);
}
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class CoordPushDependencyCheckXCommand method loadState.
@Override
protected void loadState() throws CommandException {
jpaService = Services.get().get(JPAService.class);
try {
coordAction = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(actionId));
if (coordAction != null) {
coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
LogUtils.setLogInfo(coordAction);
} else {
throw new CommandException(ErrorCode.E0605, actionId);
}
} catch (JPAExecutorException je) {
throw new CommandException(je);
}
}
Aggregations