use of org.apache.oozie.command.bundle.BundleStatusUpdateXCommand in project oozie by apache.
the class CoordUnpauseXCommand method notifyParent.
/*
* (non-Javadoc)
*
* @see org.apache.oozie.command.TransitionXCommand#notifyParent()
*/
@Override
public void notifyParent() throws CommandException {
// update bundle action
if (coordJob.getBundleId() != null) {
BundleStatusUpdateXCommand bundleStatusUpdate = new BundleStatusUpdateXCommand(coordJob, prevStatus);
bundleStatusUpdate.call();
}
}
use of org.apache.oozie.command.bundle.BundleStatusUpdateXCommand in project oozie by apache.
the class CoordResumeXCommand method notifyParent.
@Override
public void notifyParent() throws CommandException {
// update bundle action
if (this.coordJob.getBundleId() != null) {
BundleStatusUpdateXCommand bundleStatusUpdate = new BundleStatusUpdateXCommand(coordJob, prevStatus);
bundleStatusUpdate.call();
}
}
use of org.apache.oozie.command.bundle.BundleStatusUpdateXCommand in project oozie by apache.
the class CoordKillXCommand method notifyParent.
@Override
public void notifyParent() throws CommandException {
// update bundle action
if (coordJob.getBundleId() != null) {
BundleStatusUpdateXCommand bundleStatusUpdate = new BundleStatusUpdateXCommand(coordJob, prevStatus);
bundleStatusUpdate.call();
}
}
use of org.apache.oozie.command.bundle.BundleStatusUpdateXCommand in project oozie by apache.
the class CoordRerunXCommand method notifyParent.
@Override
public void notifyParent() throws CommandException {
// update bundle action
if (getPrevStatus() != null && coordJob.getBundleId() != null) {
BundleStatusUpdateXCommand bundleStatusUpdate = new BundleStatusUpdateXCommand(coordJob, getPrevStatus());
bundleStatusUpdate.call();
}
}
use of org.apache.oozie.command.bundle.BundleStatusUpdateXCommand in project oozie by apache.
the class CoordStatusTransitXCommand method updateJobStatus.
@Override
protected void updateJobStatus(Status coordStatus) throws JPAExecutorException, CommandException {
final Job.Status prevStatus = coordJob.getStatus();
boolean prevPending = coordJob.isPending();
if (isPending) {
coordJob.setPending();
} else {
coordJob.resetPending();
}
boolean isPendingStateChanged = prevPending != coordJob.isPending();
// Update the Coord Job
if (coordJob.isTerminalStatus() && (coordStatus == Job.Status.SUSPENDED || coordStatus == Job.Status.SUSPENDEDWITHERROR)) {
LOG.info("Coord Job [" + coordJob.getId() + "] status to " + coordStatus + " can not be updated as its already in Terminal state");
if (isPendingStateChanged) {
LOG.info("Pending for job [" + coordJob.getId() + "] is changed to to '" + coordJob.isPending() + "' from '" + prevStatus + "'");
coordJob.setLastModifiedTime(new Date());
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
}
return;
}
// Check for backward support when RUNNINGWITHERROR, SUSPENDEDWITHERROR and PAUSEDWITHERROR is
// not supported
coordJob.setStatus(StatusUtils.getStatusIfBackwardSupportTrue(coordStatus));
// Backward support when coordinator namespace is 0.1
coordJob.setStatus(StatusUtils.getStatus(coordJob));
if (coordJob.getStatus() != prevStatus || isPendingStateChanged) {
LOG.info("Set coordinator job [" + coordJob.getId() + "] status to '" + coordJob.getStatus() + "' from '" + prevStatus + "'");
coordJob.setLastModifiedTime(new Date());
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
}
// update bundle action only when status changes in coord job
if (coordJob.getBundleId() != null) {
if (!prevStatus.equals(coordJob.getStatus())) {
new BundleStatusUpdateXCommand(coordJob, prevStatus).call();
}
}
}
Aggregations