Search in sources :

Example 6 with ServiceException

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);
        }
    }
}
Also used : ServiceException(org.apache.oozie.service.ServiceException) CommandException(org.apache.oozie.command.CommandException) Date(java.util.Date)

Example 7 with ServiceException

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);
    }
}
Also used : SLAService(org.apache.oozie.sla.service.SLAService) ServiceException(org.apache.oozie.service.ServiceException) Date(java.util.Date)

Example 8 with ServiceException

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()));
    }
}
Also used : Services(org.apache.oozie.service.Services) ServiceException(org.apache.oozie.service.ServiceException)

Example 9 with ServiceException

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;
}
Also used : Services(org.apache.oozie.service.Services) ServiceException(org.apache.oozie.service.ServiceException) HadoopAccessorService(org.apache.oozie.service.HadoopAccessorService)

Aggregations

ServiceException (org.apache.oozie.service.ServiceException)9 Date (java.util.Date)3 CommandException (org.apache.oozie.command.CommandException)3 SLAService (org.apache.oozie.sla.service.SLAService)3 Configuration (org.apache.hadoop.conf.Configuration)2 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)2 Services (org.apache.oozie.service.Services)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 XException (org.apache.oozie.XException)1 PreconditionException (org.apache.oozie.command.PreconditionException)1 CoordELEvaluator (org.apache.oozie.coord.CoordELEvaluator)1 SLASummaryQueryExecutor (org.apache.oozie.executor.jpa.SLASummaryQueryExecutor)1 EventHandlerService (org.apache.oozie.service.EventHandlerService)1 HadoopAccessorService (org.apache.oozie.service.HadoopAccessorService)1 MemoryLocksService (org.apache.oozie.service.MemoryLocksService)1 SchedulerService (org.apache.oozie.service.SchedulerService)1 SLACalculator (org.apache.oozie.sla.SLACalculator)1