Search in sources :

Example 1 with JobRun

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

the class JobCleanupWork method run.

@Override
public void run() {
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Cleanup for JobRun with id: " + jobId);
    }
    try {
        JobRun jobRun = jobManager.get(jobId);
        jobManager.prepareComplete(jobRun, status, exceptions);
    } catch (HyracksException e) {
        // Fail the job with the caught exception during final completion.
        JobRun run = jobManager.get(jobId);
        run.getExceptions().add(e);
        run.setStatus(JobStatus.FAILURE, run.getExceptions());
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 2 with JobRun

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

the class JobStartWork method doRun.

@Override
protected void doRun() throws Exception {
    IJobManager jobManager = ccs.getJobManager();
    try {
        final CCServiceContext ccServiceCtx = ccs.getContext();
        JobRun run;
        if (!predestributed) {
            //Need to create the ActivityClusterGraph
            IActivityClusterGraphGeneratorFactory acggf = (IActivityClusterGraphGeneratorFactory) DeploymentUtils.deserialize(acggfBytes, deploymentId, ccServiceCtx);
            IActivityClusterGraphGenerator acgg = acggf.createActivityClusterGraphGenerator(jobId, ccServiceCtx, jobFlags);
            run = new JobRun(ccs, deploymentId, jobId, acggf, acgg, jobFlags);
        } else {
            //ActivityClusterGraph has already been distributed
            run = new JobRun(ccs, deploymentId, jobId, ccs.getPreDistributedJobStore().getDistributedJobDescriptor(jobId));
        }
        jobManager.add(run);
        callback.setValue(jobId);
    } catch (Exception e) {
        callback.setException(e);
    }
}
Also used : IActivityClusterGraphGeneratorFactory(org.apache.hyracks.api.job.IActivityClusterGraphGeneratorFactory) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) IActivityClusterGraphGenerator(org.apache.hyracks.api.job.IActivityClusterGraphGenerator) CCServiceContext(org.apache.hyracks.control.cc.application.CCServiceContext) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 3 with JobRun

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

the class JobletCleanupNotificationWork method runWork.

@Override
public void runWork() {
    IJobManager jobManager = ccs.getJobManager();
    final JobRun run = jobManager.get(jobId);
    Set<String> cleanupPendingNodes = run.getCleanupPendingNodeIds();
    if (!cleanupPendingNodes.remove(nodeId)) {
        if (LOGGER.isLoggable(Level.WARNING)) {
            LOGGER.warning(nodeId + " not in pending cleanup nodes set: " + cleanupPendingNodes + " for Job: " + jobId);
        }
        return;
    }
    INodeManager nodeManager = ccs.getNodeManager();
    NodeControllerState ncs = nodeManager.getNodeControllerState(nodeId);
    if (ncs != null) {
        ncs.getActiveJobIds().remove(jobId);
    }
    if (cleanupPendingNodes.isEmpty()) {
        try {
            jobManager.finalComplete(run);
        } catch (HyracksException e) {
            // Fail the job with the caught exception during final completion.
            run.getExceptions().add(e);
            run.setStatus(JobStatus.FAILURE, run.getExceptions());
        }
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 4 with JobRun

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

the class RegisterPartitionAvailibilityWork method run.

@Override
public void run() {
    final PartitionId pid = partitionDescriptor.getPartitionId();
    IJobManager jobManager = ccs.getJobManager();
    JobRun run = jobManager.get(pid.getJobId());
    if (run == null) {
        return;
    }
    PartitionMatchMaker pmm = run.getPartitionMatchMaker();
    List<Pair<PartitionDescriptor, PartitionRequest>> matches = pmm.registerPartitionDescriptor(partitionDescriptor);
    for (Pair<PartitionDescriptor, PartitionRequest> match : matches) {
        try {
            PartitionUtils.reportPartitionMatch(ccs, pid, match);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : PartitionRequest(org.apache.hyracks.control.common.job.PartitionRequest) PartitionDescriptor(org.apache.hyracks.control.common.job.PartitionDescriptor) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) PartitionMatchMaker(org.apache.hyracks.control.cc.partitions.PartitionMatchMaker) PartitionId(org.apache.hyracks.api.partitions.PartitionId) JobRun(org.apache.hyracks.control.cc.job.JobRun) Pair(org.apache.commons.lang3.tuple.Pair)

Example 5 with JobRun

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

the class RemoveDeadNodesWork method run.

@Override
public void run() {
    try {
        INodeManager nodeManager = ccs.getNodeManager();
        Pair<Collection<String>, Collection<JobId>> result = nodeManager.removeDeadNodes();
        Collection<String> deadNodes = result.getLeft();
        Collection<JobId> affectedJobIds = result.getRight();
        int size = affectedJobIds.size();
        if (size > 0) {
            if (LOGGER.isLoggable(Level.INFO)) {
                LOGGER.info("Number of affected jobs: " + size);
            }
            IJobManager jobManager = ccs.getJobManager();
            for (JobId jobId : affectedJobIds) {
                JobRun run = jobManager.get(jobId);
                if (run != null) {
                    run.getExecutor().notifyNodeFailures(deadNodes);
                }
            }
        }
        if (!deadNodes.isEmpty()) {
            ccs.getContext().notifyNodeFailure(deadNodes);
        }
    } catch (HyracksException e) {
        LOGGER.log(Level.WARNING, "Uncaught exception on notifyNodeFailure", e);
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) Collection(java.util.Collection) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) JobId(org.apache.hyracks.api.job.JobId) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Aggregations

JobRun (org.apache.hyracks.control.cc.job.JobRun)19 IJobManager (org.apache.hyracks.control.cc.job.IJobManager)9 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)3 ActivityPlan (org.apache.hyracks.control.cc.job.ActivityPlan)3 Task (org.apache.hyracks.control.cc.job.Task)3 TaskCluster (org.apache.hyracks.control.cc.job.TaskCluster)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 TaskId (org.apache.hyracks.api.dataflow.TaskId)2 ActivityCluster (org.apache.hyracks.api.job.ActivityCluster)2 PartitionId (org.apache.hyracks.api.partitions.PartitionId)2 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)2 ActivityClusterPlan (org.apache.hyracks.control.cc.job.ActivityClusterPlan)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 JobProfile (org.apache.hyracks.control.common.job.profiling.om.JobProfile)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1