Search in sources :

Example 6 with IJobManager

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

the class TaskFailureWork method performEvent.

@Override
protected void performEvent(TaskAttempt ta) {
    IJobManager jobManager = ccs.getJobManager();
    JobRun run = jobManager.get(jobId);
    ccs.getDatasetDirectoryService().reportJobFailure(jobId, exceptions);
    run.getExecutor().notifyTaskFailure(ta, exceptions);
}
Also used : IJobManager(org.apache.hyracks.control.cc.job.IJobManager) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 7 with IJobManager

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

the class JobExecutor method notifyNodeFailures.

/**
     * Indicates that the provided set of nodes have left the cluster.
     *
     * @param deadNodes
     *            - Set of failed nodes
     */
public void notifyNodeFailures(Collection<String> deadNodes) {
    try {
        jobRun.getPartitionMatchMaker().notifyNodeFailures(deadNodes);
        jobRun.getParticipatingNodeIds().removeAll(deadNodes);
        jobRun.getCleanupPendingNodeIds().removeAll(deadNodes);
        if (jobRun.getPendingStatus() != null && jobRun.getCleanupPendingNodeIds().isEmpty()) {
            IJobManager jobManager = ccs.getJobManager();
            jobManager.finalComplete(jobRun);
            return;
        }
        abortOngoingTaskClusters(ta -> deadNodes.contains(ta.getNodeId()), ta -> HyracksException.create(ErrorCode.NODE_FAILED, ta.getNodeId()));
        startRunnableActivityClusters();
    } catch (Exception e) {
        abortJob(Collections.singletonList(e));
    }
}
Also used : IJobManager(org.apache.hyracks.control.cc.job.IJobManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 8 with IJobManager

use of org.apache.hyracks.control.cc.job.IJobManager 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)

Example 9 with IJobManager

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

the class AbstractTaskLifecycleWork method runWork.

@Override
public final void runWork() {
    IJobManager jobManager = ccs.getJobManager();
    JobRun run = jobManager.get(jobId);
    if (run != null) {
        TaskId tid = taId.getTaskId();
        Map<ActivityId, ActivityCluster> activityClusterMap = run.getActivityClusterGraph().getActivityMap();
        ActivityCluster ac = activityClusterMap.get(tid.getActivityId());
        if (ac != null) {
            Map<ActivityId, ActivityPlan> taskStateMap = run.getActivityClusterPlanMap().get(ac.getId()).getActivityPlanMap();
            Task[] taskStates = taskStateMap.get(tid.getActivityId()).getTasks();
            if (taskStates != null && taskStates.length > tid.getPartition()) {
                Task ts = taskStates[tid.getPartition()];
                TaskCluster tc = ts.getTaskCluster();
                List<TaskClusterAttempt> taskClusterAttempts = tc.getAttempts();
                if (taskClusterAttempts != null && taskClusterAttempts.size() > taId.getAttempt()) {
                    TaskClusterAttempt tca = taskClusterAttempts.get(taId.getAttempt());
                    TaskAttempt ta = tca.getTaskAttempts().get(tid);
                    if (ta != null) {
                        performEvent(ta);
                    }
                }
            }
        }
    }
}
Also used : Task(org.apache.hyracks.control.cc.job.Task) TaskId(org.apache.hyracks.api.dataflow.TaskId) TaskClusterAttempt(org.apache.hyracks.control.cc.job.TaskClusterAttempt) ActivityId(org.apache.hyracks.api.dataflow.ActivityId) ActivityPlan(org.apache.hyracks.control.cc.job.ActivityPlan) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) ActivityCluster(org.apache.hyracks.api.job.ActivityCluster) TaskCluster(org.apache.hyracks.control.cc.job.TaskCluster) TaskAttempt(org.apache.hyracks.control.cc.job.TaskAttempt) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 10 with IJobManager

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

the class GetActivityClusterGraphJSONWork method doRun.

@Override
protected void doRun() throws Exception {
    IJobManager jobManager = ccs.getJobManager();
    ObjectMapper om = new ObjectMapper();
    JobRun run = jobManager.get(jobId);
    if (run == null) {
        json = om.createObjectNode();
        return;
    }
    json = run.getActivityClusterGraph().toJSON();
}
Also used : IJobManager(org.apache.hyracks.control.cc.job.IJobManager) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Aggregations

IJobManager (org.apache.hyracks.control.cc.job.IJobManager)12 JobRun (org.apache.hyracks.control.cc.job.JobRun)9 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)4 PartitionId (org.apache.hyracks.api.partitions.PartitionId)2 CCServiceContext (org.apache.hyracks.control.cc.application.CCServiceContext)2 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)2 PartitionMatchMaker (org.apache.hyracks.control.cc.partitions.PartitionMatchMaker)2 PartitionDescriptor (org.apache.hyracks.control.common.job.PartitionDescriptor)2 PartitionRequest (org.apache.hyracks.control.common.job.PartitionRequest)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Collection (java.util.Collection)1 Pair (org.apache.commons.lang3.tuple.Pair)1 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)1 TaskId (org.apache.hyracks.api.dataflow.TaskId)1 ActivityCluster (org.apache.hyracks.api.job.ActivityCluster)1 IActivityClusterGraphGenerator (org.apache.hyracks.api.job.IActivityClusterGraphGenerator)1 IActivityClusterGraphGeneratorFactory (org.apache.hyracks.api.job.IActivityClusterGraphGeneratorFactory)1 JobId (org.apache.hyracks.api.job.JobId)1 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)1