Search in sources :

Example 6 with CCServiceContext

use of org.apache.hyracks.control.cc.application.CCServiceContext in project asterixdb by apache.

the class DistributeJobWork method doRun.

@Override
protected void doRun() throws Exception {
    try {
        final CCServiceContext ccServiceCtx = ccs.getContext();
        ccs.getPreDistributedJobStore().checkForExistingDistributedJobDescriptor(jobId);
        IActivityClusterGraphGeneratorFactory acggf = (IActivityClusterGraphGeneratorFactory) DeploymentUtils.deserialize(acggfBytes, null, ccServiceCtx);
        IActivityClusterGraphGenerator acgg = acggf.createActivityClusterGraphGenerator(jobId, ccServiceCtx, EnumSet.noneOf(JobFlag.class));
        ActivityClusterGraph acg = acgg.initialize();
        ccs.getPreDistributedJobStore().addDistributedJobDescriptor(jobId, acg, acggf.getJobSpecification(), acgg.getConstraints());
        ccServiceCtx.notifyJobCreation(jobId, acggf.getJobSpecification());
        byte[] acgBytes = JavaSerializationUtils.serialize(acg);
        INodeManager nodeManager = ccs.getNodeManager();
        for (NodeControllerState node : nodeManager.getAllNodeControllerStates()) {
            node.getNodeController().distributeJob(jobId, acgBytes);
        }
        callback.setValue(jobId);
    } catch (Exception e) {
        callback.setException(e);
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) JobFlag(org.apache.hyracks.api.job.JobFlag) ActivityClusterGraph(org.apache.hyracks.api.job.ActivityClusterGraph) IActivityClusterGraphGeneratorFactory(org.apache.hyracks.api.job.IActivityClusterGraphGeneratorFactory) IActivityClusterGraphGenerator(org.apache.hyracks.api.job.IActivityClusterGraphGenerator) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) CCServiceContext(org.apache.hyracks.control.cc.application.CCServiceContext)

Aggregations

CCServiceContext (org.apache.hyracks.control.cc.application.CCServiceContext)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IActivityClusterGraphGenerator (org.apache.hyracks.api.job.IActivityClusterGraphGenerator)2 IActivityClusterGraphGeneratorFactory (org.apache.hyracks.api.job.IActivityClusterGraphGeneratorFactory)2 JobId (org.apache.hyracks.api.job.JobId)2 JobSpecification (org.apache.hyracks.api.job.JobSpecification)2 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)2 IJobManager (org.apache.hyracks.control.cc.job.IJobManager)2 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)1 ActivityClusterGraph (org.apache.hyracks.api.job.ActivityClusterGraph)1 JobFlag (org.apache.hyracks.api.job.JobFlag)1 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)1 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)1 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)1 JobManager (org.apache.hyracks.control.cc.job.JobManager)1 JobRun (org.apache.hyracks.control.cc.job.JobRun)1 LogFile (org.apache.hyracks.control.common.logs.LogFile)1