use of org.apache.oozie.command.PreconditionException in project oozie by apache.
the class BundleSubmitXCommand method eagerVerifyPrecondition.
@Override
protected void eagerVerifyPrecondition() throws CommandException, PreconditionException {
try {
mergeDefaultConfig();
String appXml = readAndValidateXml();
bundleBean.setOrigJobXml(appXml);
LOG.debug("jobXml after initial validation " + XmlUtils.prettyPrint(appXml).toString());
} catch (BundleJobException ex) {
LOG.warn("BundleJobException: ", ex);
throw new CommandException(ex);
} catch (IllegalArgumentException iex) {
LOG.warn("IllegalArgumentException: ", iex);
throw new CommandException(ErrorCode.E1310, iex.getMessage(), iex);
} catch (Exception ex) {
LOG.warn("Exception: ", ex);
throw new CommandException(ErrorCode.E1310, ex.getMessage(), ex);
}
}
use of org.apache.oozie.command.PreconditionException in project oozie by apache.
the class BundleStatusUpdateXCommand method verifyPrecondition.
@Override
protected void verifyPrecondition() throws CommandException, PreconditionException {
if (bundleaction.getStatusStr().compareToIgnoreCase(prevStatus.toString()) != 0 && bundleaction.getCoordId() != null) {
// to allow recovery service to pick and kill the coord job
if (bundleaction.isTerminalStatus() && coordjob.isTerminalStatus()) {
LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}], " + "but coord job is currently in terminal state = [{3}]", bundleaction.getBundleActionId(), bundleaction.getStatusStr(), prevStatus.toString(), coordjob.getStatus());
return;
}
if (bundleaction.isPending() && coordjob.getStatus().equals(bundleaction.getStatus()) && !ignorePending) {
bundleaction.decrementAndGetPending();
}
bundleaction.setLastModifiedTime(new Date());
try {
BundleActionQueryExecutor.getInstance().executeUpdate(BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, bundleaction);
} catch (JPAExecutorException je) {
throw new CommandException(je);
}
LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}] and current coord" + " status [{3}], decrement pending so new pending = [{4}]", bundleaction.getBundleActionId(), bundleaction.getStatusStr(), prevStatus.toString(), coordjob.getStatusStr(), bundleaction.getPending());
throw new PreconditionException(ErrorCode.E1308, bundleaction.getStatusStr(), prevStatus.toString());
} else if (bundleaction.getStatusStr().compareToIgnoreCase(prevStatus.toString()) != 0) {
LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}], " + "pending = [{3}] and bundle not yet updated with coord-id", bundleaction.getBundleActionId(), bundleaction.getStatusStr(), prevStatus.toString(), bundleaction.getPending());
}
}
Aggregations