/** * <i>Shortcut.</i> Creates an {@link Executor} using the {@link #getExecutorFactory()}. * * @return the {@link Executor} */ public Executor createExecutor(Job job) { return this.getExecutorFactory().create(job); }
@Override protected void disposeUnreferenced() { for (ExecutionResource loopInvariant : this.loopInvariants) { loopInvariant.noteDiscardedReference(true); } this.loopInvariants = null; CrossPlatformExecutor.this.removeLoopContext(this.loop); if (this.prevTransition != null) this.prevTransition.noteDiscardedReference(true); if (this.currentIteration != null) this.currentIteration.noteDiscardedReference(true); if (this.nextTransition != null) this.nextTransition.noteDiscardedReference(true); }
/** * Create a new {@link ExecutionStageLoopIterationContext} for the next transition if it does not exist. * * @return the {@link ExecutionStageLoopIterationContext} for the next transition */ public ExecutionStageLoopIterationContext getOrCreateNextTransition() { if (this.nextTransition == null) { this.nextTransition = this.createIterationContext(); } return this.nextTransition; }
/** * Executes an {@link ExecutionTask}. * * @param taskActivator provides the {@link ExecutionTask} and its input dependenchannelInstancees. * @param isRequestEagerExecution whether the {@link ExecutionTask} should be executed eagerly if possible * @return the output {@link ChannelInstance}s of the {@link ExecutionTask} */ private Tuple<List<ChannelInstance>, PartialExecution> execute(TaskActivator taskActivator, boolean isRequestEagerExecution) { return this.execute( taskActivator.getTask(), taskActivator.getInputChannelInstances(), taskActivator.getOperatorContext(), isRequestEagerExecution ); }
/** * @return whether the {@link #task} has suffichannelInstanceent input dependenchannelInstancees satisfied */ protected boolean isReady() { return this.isLoopInitializationReady() || this.isLoopIterationReady() || this.isPlainReady(); }
@Override public void execute(ExecutionStage stage, OptimizationContext optimizationContext, ExecutionState executionState) { assert !this.isDisposed() : String.format("%s has been disposed.", this); final StageExecution stageExecution = new StageExecution(stage, optimizationContext, executionState); stageExecution.executeStage(); }
public ChannelInstance getChannelInstance(Channel channel, boolean isPeekingToNextTransition) { final ExecutionStageLoop loop = getExecutionStageLoop(channel); if (loop == null) { return this.channelInstances.get(channel); } else { final ExecutionStageLoopContext loopContext = this.getOrCreateLoopContext(loop); return loopContext.getChannelInstance(channel, isPeekingToNextTransition); } }
private ExecutionStageLoopIterationContext createIterationContext() { final ExecutionStageLoopIterationContext iteration = new ExecutionStageLoopIterationContext(this); iteration.noteObtainedReference(); return iteration; }
public ChannelLineageNode(final ChannelInstance channelInstance) { assert !channelInstance.wasProduced(); this.channelInstance = channelInstance; this.channelInstance.noteObtainedReference(); }
/** * Executes the {@link ExecutionStage} and contributes results to the {@link #executionState}. */ void executeStage() { this.execute(); this.updateExecutionState(); }
/** * Creates a new instance. * * @param sparkContext the {@link JavaSparkContext} to be wrapped */ public SparkContextReference(CrossPlatformExecutor crossPlatformExecutor, JavaSparkContext sparkContext) { super(null); if (crossPlatformExecutor != null) { crossPlatformExecutor.registerGlobal(this); } this.sparkContext = sparkContext; }
/** * Switch the state of this instance: Age the next to the previous transition and create a new * current {@link ExecutionStageLoopIterationContext}. */ public void activateNextIteration() { logger.info("Activating next iteration."); if (this.currentIteration != null) this.currentIteration.noteDiscardedReference(true); this.currentIteration = this.createIterationContext(); if (this.prevTransition != null) this.prevTransition.noteDiscardedReference(true); this.prevTransition = this.nextTransition; this.nextTransition = null; }
/** * Disposes this instance. */ protected void dispose() { // Drop references towards the #inputChannelInstances. for (ChannelInstance inputChannelInstance : this.inputChannelInstances) { if (inputChannelInstance != null) { inputChannelInstance.noteDiscardedReference(true); } } }
/** * Estimate the {@link LoadProfile} for all {@link AtomicExecution}s in this instance. * * @return the {@link LoadProfile} */ public LoadProfile estimateLoad() { return this.estimateLoad(this.estimationContext); }
/** * Estimate the {@link TimeEstimate} for all {@link AtomicExecution}s in this instance. * * @return the {@link TimeEstimate} */ public TimeEstimate estimateExecutionTime() { return this.estimateExecutionTime(this.estimationContext); }
@Override protected void disposeUnreferenced() { this.dispose(); }
@Override public ChannelInstance getChannelInstance(Channel channel) { return this.getChannelInstance(channel, false); }
@Override protected void disposeUnreferenced() { this.dispose(); }
/** * Removes the previous transition {@link ExecutionStageLoopIterationContext}. Included resources * will not be provided anymore by this instance. */ public void scrapPreviousTransitionContext() { if (this.prevTransition != null) this.prevTransition.noteDiscardedReference(true); this.prevTransition = null; } }
@Override public AtomicExecution deserialize(JSONObject json) { return this.deserialize(json, AtomicExecution.class); }