Search in sources :

Example 1 with JobManager

use of org.apache.hyracks.control.cc.job.JobManager in project asterixdb by apache.

the class ClusterControllerService method startApplication.

private void startApplication() throws Exception {
    serviceCtx = new CCServiceContext(this, serverCtx, ccContext, ccConfig.getAppConfig());
    serviceCtx.addJobLifecycleListener(datasetDirectoryService);
    executor = Executors.newCachedThreadPool(serviceCtx.getThreadFactory());
    application.start(serviceCtx, ccConfig.getAppArgsArray());
    IJobCapacityController jobCapacityController = application.getJobCapacityController();
    // Job manager is in charge of job lifecycle management.
    try {
        Constructor<?> jobManagerConstructor = this.getClass().getClassLoader().loadClass(ccConfig.getJobManagerClass()).getConstructor(CCConfig.class, ClusterControllerService.class, IJobCapacityController.class);
        jobManager = (IJobManager) jobManagerConstructor.newInstance(ccConfig, this, jobCapacityController);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
        if (LOGGER.isLoggable(Level.WARNING)) {
            LOGGER.log(Level.WARNING, "class " + ccConfig.getJobManagerClass() + " could not be used: ", e);
        }
        // Falls back to the default implementation if the user-provided class name is not valid.
        jobManager = new JobManager(ccConfig, this, jobCapacityController);
    }
}
Also used : IJobCapacityController(org.apache.hyracks.api.job.resource.IJobCapacityController) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) JobManager(org.apache.hyracks.control.cc.job.JobManager) CCServiceContext(org.apache.hyracks.control.cc.application.CCServiceContext) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)1 CCServiceContext (org.apache.hyracks.control.cc.application.CCServiceContext)1 IJobManager (org.apache.hyracks.control.cc.job.IJobManager)1 JobManager (org.apache.hyracks.control.cc.job.JobManager)1