public JobRun(ClusterControllerService ccs, DeploymentId deploymentId, JobId jobId, IActivityClusterGraphGeneratorFactory acggf, IActivityClusterGraphGenerator acgg, Set<JobFlag> jobFlags) { this(deploymentId, jobId, jobFlags, acggf.getJobSpecification(), acgg.initialize()); this.scheduler = new JobExecutor(ccs, this, acgg.getConstraints(), null); }
@Override protected void doRun() throws Exception { try { final CCServiceContext ccServiceCtx = ccs.getContext(); if (!upsert) { ccs.getDeployedJobSpecStore().checkForExistingDeployedJobSpecDescriptor(deployedJobSpecId); } IActivityClusterGraphGeneratorFactory acggf = (IActivityClusterGraphGeneratorFactory) DeploymentUtils.deserialize(acggfBytes, null, ccServiceCtx); IActivityClusterGraphGenerator acgg = acggf.createActivityClusterGraphGenerator(ccServiceCtx, EnumSet.noneOf(JobFlag.class)); ActivityClusterGraph acg = acgg.initialize(); ccs.getDeployedJobSpecStore().addDeployedJobSpecDescriptor(deployedJobSpecId, acg, acggf.getJobSpecification(), acgg.getConstraints()); byte[] acgBytes = JavaSerializationUtils.serialize(acg); INodeManager nodeManager = ccs.getNodeManager(); for (NodeControllerState node : nodeManager.getAllNodeControllerStates()) { node.getNodeController().deployJobSpec(deployedJobSpecId, acgBytes, upsert); } callback.setValue(deployedJobSpecId); } catch (Exception e) { callback.setException(e); } } }