@CheckForNull public static TimingInfo computeChunkTiming(@Nonnull WorkflowRun run, long internalPauseDuration, @Nonnull MemoryFlowChunk chunk) { return computeChunkTiming(run, internalPauseDuration, chunk.getFirstNode(), chunk.getLastNode(), chunk.getNodeAfter()); }
protected void resetChunk(@Nonnull MemoryFlowChunk chunk) { chunk.setFirstNode(null); chunk.setLastNode(null); chunk.setNodeBefore(null); chunk.setNodeAfter(null); chunk.setPauseTimeMillis(0); }
@Override public void chunkEnd(@Nonnull FlowNode endNode, @CheckForNull FlowNode afterChunk, @Nonnull ForkScanner scanner) { chunk.setLastNode(endNode); chunk.setNodeAfter(afterChunk); }
/** * Return status or null if not executed all (null FlowExecution) * Note: API consumers MUST use {@link #coerceStatusApi(GenericStatus, StatusApiVersion)} on outputs * to safely handle addition of new statuses. * @param run * @param chunk * @return Status or null if not executed all (null FlowExecution) */ @CheckForNull public static GenericStatus computeChunkStatus2(@Nonnull WorkflowRun run, @Nonnull MemoryFlowChunk chunk) { FlowExecution exec = run.getExecution(); if (exec == null) { return null; } if (chunk instanceof ParallelMemoryFlowChunk) { ParallelMemoryFlowChunk par = ((ParallelMemoryFlowChunk) chunk); return condenseStatus(computeBranchStatuses2(run, par).values()); } else { return computeChunkStatus2(run, chunk.getNodeBefore(), chunk.getFirstNode(), chunk.getLastNode(), chunk.getNodeAfter()); } }
@Override public void chunkStart(@Nonnull FlowNode startNode, @CheckForNull FlowNode beforeBlock, @Nonnull ForkScanner scanner) { chunk.setNodeBefore(beforeBlock); chunk.setFirstNode(startNode); handleChunkDone(chunk); resetChunk(chunk); }
@Nonnull /** Get statuses for each branch - note: some statuses may be null, API consumers MUST use {@link #coerceStatusApi(GenericStatus, StatusApiVersion)} on outputs * to safely handle addition of new statuses. */ public static Map<String, GenericStatus> computeBranchStatuses2(@Nonnull WorkflowRun run, @Nonnull ParallelMemoryFlowChunk parallel) { Map<String,MemoryFlowChunk> branches = parallel.getBranches(); List<BlockStartNode> starts = new ArrayList<BlockStartNode>(branches.size()); List<FlowNode> ends = new ArrayList<FlowNode>(branches.size()); // We can optimize this if needed by not fetching the LabelAction below for (MemoryFlowChunk chunk : branches.values()) { starts.add((BlockStartNode)chunk.getFirstNode()); ends.add(chunk.getLastNode()); } return computeBranchStatuses2(run, parallel.getFirstNode(), starts, ends, parallel.getLastNode()); }
public MemoryFlowChunk(@CheckForNull FlowNode before, @Nonnull FlowNode firstNode, @Nonnull FlowNode lastNode, @CheckForNull FlowNode nodeAfter) { this.setNodeBefore(before); this.setFirstNode(firstNode); this.setLastNode(lastNode); this.setNodeAfter(lastNode); }