use of org.apache.oozie.service.ServiceException in project oozie by apache.
the class SLACalculatorMemory method updateParams.
private void updateParams(SLACalcStatus slaCalc, Map<String, String> newParams) throws ServiceException {
SLARegistrationBean reg = slaCalc.getSLARegistrationBean();
if (newParams != null) {
try {
Date newNominal = SLAOperations.setNominalTime(newParams.get(RestConstants.SLA_NOMINAL_TIME), reg);
SLAOperations.setExpectedStart(newParams.get(RestConstants.SLA_SHOULD_START), newNominal, reg);
SLAOperations.setExpectedEnd(newParams.get(RestConstants.SLA_SHOULD_END), newNominal, reg);
SLAOperations.setExpectedDuration(newParams.get(RestConstants.SLA_MAX_DURATION), reg);
} catch (CommandException ce) {
throw new ServiceException(ce);
}
}
}
use of org.apache.oozie.service.ServiceException in project oozie by apache.
the class SLAJobEventListener method sendEventToSLAService.
private void sendEventToSLAService(JobEvent event, String status) {
Date startTime = event.getStartTime();
Date endTime = event.getEndTime();
try {
Services.get().get(SLAService.class).addStatusEvent(event.getId(), status, event.getEventStatus(), startTime, endTime);
} catch (ServiceException se) {
XLog.getLog(SLAService.class).error("Exception happened while sending Job-Status event for SLA", se);
}
}
use of org.apache.oozie.service.ServiceException in project oozie by apache.
the class ServicesProvider method get.
@Override
public Services get() {
Services oozieServices = null;
try {
oozieServices = new Services();
oozieServices.init();
return oozieServices;
} catch (ServiceException e) {
if (oozieServices != null) {
oozieServices.destroy();
}
throw new IllegalStateException(String.format("Could not instantiate Oozie services. [e.message=%s]", e.getMessage()));
}
}
use of org.apache.oozie.service.ServiceException in project oozie by apache.
the class DiagBundleCollectorDriver method setHadoopConfig.
private boolean setHadoopConfig() {
final String oozieHome = System.getenv("OOZIE_HOME");
if (oozieHome == null) {
System.err.println("OOZIE_HOME environment variable is not set. Make sure you've set it to an absolute path.");
return false;
}
System.setProperty(Services.OOZIE_HOME_DIR, oozieHome);
try {
final Services services = initOozieServices();
final HadoopAccessorService hadoopAccessorService = services.get(HadoopAccessorService.class);
hadoopConfig = hadoopAccessorService.createConfiguration("*");
} catch (ServiceException e) {
System.err.printf("Could not initialize Hadoop configuration: %s%n", e.getMessage());
return false;
}
return true;
}
Aggregations