private void buildSubJobBatchWorkUnits() { List<Flow> flows = this.split.getFlows(); splitFlowWorkUnits = new ArrayList<BatchSplitFlowWorkUnit>(); for (Flow flow : flows) { // 1. First, we build the subjob JSLJob model for flows in split JSLJob splitFlowJSLJob = ParallelStepBuilder.buildFlowInSplitSubJob(runtimeWorkUnitExecution.getTopLevelInstanceId(), runtimeWorkUnitExecution.getWorkUnitJobContext(), this.split, flow); subJobs.add(splitFlowJSLJob); // 2. Next, we build a (persisted) execution and a work unit (thread) around it. SplitFlowConfig splitFlowConfig = new SplitFlowConfig(runtimeWorkUnitExecution.getTopLevelNameInstanceExecutionInfo(), split.getId(), flow.getId(), runtimeWorkUnitExecution.getCorrelationId()); BatchSplitFlowWorkUnit workUnit = getBatchKernelService().createSplitFlowWorkUnit(splitFlowConfig, splitFlowJSLJob, completedWorkQueue); splitFlowWorkUnits.add(workUnit); } }
public static JSLJob buildFlowInSplitSubJob(long topLevelJobInstanceId, JobContext jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Uses the true top-level job instance id, not an internal "subjob" id. String subJobId = generateSubJobId(topLevelJobInstanceId, split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); return subJob; }
public static JSLJob buildFlowInSplitSubJob(Long parentJobExecutionId, JobContext jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Set the generated subjob id String subJobId = generateSubJobId(parentJobExecutionId, split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); return subJob; }
@Override public Split substituteProperties(final Split split, final Properties submittedProps, final Properties parentProps) { // resolve all the properties used in attributes and update the JAXB model split.setId(this.replaceAllProperties(split.getId(), submittedProps, parentProps)); split.setNextFromAttribute(this.replaceAllProperties(split.getNextFromAttribute(), submittedProps, parentProps)); // Resolve all the properties defined for this step Properties currentProps = parentProps; for (final Flow flow : split.getFlows()) { PropertyResolverFactory.createFlowPropertyResolver(this.isPartitionedStep).substituteProperties(flow, submittedProps, currentProps); } return split; }
@Override public Split substituteProperties(final Split split, final Properties submittedProps, final Properties parentProps) { // resolve all the properties used in attributes and update the JAXB model split.setId(this.replaceAllProperties(split.getId(), submittedProps, parentProps)); split.setNextFromAttribute(this.replaceAllProperties(split.getNextFromAttribute(), submittedProps, parentProps)); // Resolve all the properties defined for this step Properties currentProps = parentProps; for (final Flow flow : split.getFlows()) { PropertyResolverFactory.createFlowPropertyResolver(this.isPartitionedStep).substituteProperties(flow, submittedProps, currentProps); } return split; }
@Override public Split substituteProperties(final Split split, final Properties submittedProps, final Properties parentProps) { // resolve all the properties used in attributes and update the JAXB model split.setId(this.replaceAllProperties(split.getId(), submittedProps, parentProps)); split.setNextFromAttribute(this.replaceAllProperties(split.getNextFromAttribute(), submittedProps, parentProps)); // Resolve all the properties defined for this step Properties currentProps = parentProps; for (final Flow flow : split.getFlows()) { PropertyResolverFactory.createFlowPropertyResolver(this.isPartitionedStep).substituteProperties(flow, submittedProps, currentProps); } return split; }
public static JSLJob buildFlowInSplitSubJob(JobContextImpl jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Uses the true top-level job instance id, not an internal "subjob" id. String subJobId = generateSubJobId(jobContext.getInstanceId(), split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); jobContext.addTopLevelContextProperties(subJob.getProperties()); return subJob; }