use of org.apache.oozie.util.ParameterVerifierException in project oozie by apache.
the class CoordSubmitXCommand method submitJob.
protected String submitJob() throws CommandException {
String jobId = null;
InstrumentUtils.incrJobCounter(getName(), 1, getInstrumentation());
boolean exceptionOccured = false;
try {
mergeDefaultConfig();
String appXml = readAndValidateXml();
coordJob.setOrigJobXml(appXml);
LOG.debug("jobXml after initial validation " + XmlUtils.prettyPrint(appXml).toString());
Element eXml = XmlUtils.parseXml(appXml);
String appNamespace = readAppNamespace(eXml);
coordJob.setAppNamespace(appNamespace);
ParameterVerifier.verifyParameters(conf, eXml);
appXml = XmlUtils.removeComments(appXml);
initEvaluators();
Element eJob = basicResolveAndIncludeDS(appXml, conf, coordJob);
validateCoordinatorJob();
// checking if the coordinator application data input/output events
// specify multiple data instance values in erroneous manner
checkMultipleTimeInstances(eJob, COORD_INPUT_EVENTS, COORD_INPUT_EVENTS_DATA_IN);
checkMultipleTimeInstances(eJob, COORD_OUTPUT_EVENTS, COORD_OUTPUT_EVENTS_DATA_OUT);
LOG.debug("jobXml after all validation " + XmlUtils.prettyPrint(eJob).toString());
jobId = storeToDB(appXml, eJob, coordJob);
// log job info for coordinator job
LogUtils.setLogInfo(coordJob);
if (!dryrun) {
queueMaterializeTransitionXCommand(jobId);
} else {
return getDryRun(coordJob);
}
} catch (JDOMException jex) {
exceptionOccured = true;
LOG.warn("ERROR: ", jex);
throw new CommandException(ErrorCode.E0700, jex.getMessage(), jex);
} catch (CoordinatorJobException cex) {
exceptionOccured = true;
LOG.warn("ERROR: ", cex);
throw new CommandException(cex);
} catch (ParameterVerifierException pex) {
exceptionOccured = true;
LOG.warn("ERROR: ", pex);
throw new CommandException(pex);
} catch (IllegalArgumentException iex) {
exceptionOccured = true;
LOG.warn("ERROR: ", iex);
throw new CommandException(ErrorCode.E1003, iex.getMessage(), iex);
} catch (Exception ex) {
exceptionOccured = true;
LOG.warn("ERROR: ", ex);
throw new CommandException(ErrorCode.E0803, ex.getMessage(), ex);
} finally {
if (exceptionOccured) {
if (coordJob.getId() == null || coordJob.getId().equalsIgnoreCase("")) {
coordJob.setStatus(CoordinatorJob.Status.FAILED);
coordJob.resetPending();
}
}
}
return jobId;
}
use of org.apache.oozie.util.ParameterVerifierException in project oozie by apache.
the class LiteWorkflowAppParser method validateAndParse.
/**
* Parse and validate xml to {@link LiteWorkflowApp}
*
* @param reader
* @return LiteWorkflowApp
* @throws WorkflowException
*/
public LiteWorkflowApp validateAndParse(Reader reader, Configuration jobConf, Configuration configDefault) throws WorkflowException {
try {
StringWriter writer = new StringWriter();
IOUtils.copyCharStream(reader, writer);
String strDef = writer.toString();
if (schema != null) {
Validator validator = SchemaService.getValidator(schema);
validator.validate(new StreamSource(new StringReader(strDef)));
}
Element wfDefElement = XmlUtils.parseXml(strDef);
ParameterVerifier.verifyParameters(jobConf, wfDefElement);
LiteWorkflowApp app = parse(strDef, wfDefElement, configDefault, jobConf);
boolean validateForkJoin = false;
if (jobConf.getBoolean(WF_VALIDATE_FORK_JOIN, true) && ConfigurationService.getBoolean(VALIDATE_FORK_JOIN)) {
validateForkJoin = true;
}
LiteWorkflowValidator validator = new LiteWorkflowValidator();
validator.validateWorkflow(app, validateForkJoin);
return app;
} catch (ParameterVerifierException ex) {
throw new WorkflowException(ex);
} catch (JDOMException ex) {
throw new WorkflowException(ErrorCode.E0700, ex.getMessage(), ex);
} catch (SAXException ex) {
throw new WorkflowException(ErrorCode.E0701, ex.getMessage(), ex);
} catch (IOException ex) {
throw new WorkflowException(ErrorCode.E0702, ex.getMessage(), ex);
}
}
Aggregations