Class TaskWithoutSharedState<T extends InputFromManager>
- Type Parameters:
T
- input-object type
- Direct Known Subclasses:
Develop
,HelloWorld
public abstract class TaskWithoutSharedState<T extends InputFromManager>
extends Task<T,NoSharedState>
A particular type of task that doesn't share-state between running jobs
N.B. this is an important differentiation when it comes to parallelization
Sharing-state between running jobs is only possible when they are run as different threads in the same VM.
If the different jobs are processes on different VMs (e.g. on different cloud instances) this task (and its subclasses) should work without problems. For the tasks with shared-state, they will break.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
afterAllJobsAreExecuted
(NoSharedState sharedState, InputOutputContext context) Called once after all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.final NoSharedState
beforeAnyJobIsExecuted
(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<T> inputs, ParametersExperiment parameters) Called once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.Methods inherited from class org.anchoranalysis.experiment.bean.task.Task
defaultOutputs, doJobOnInput, executeJob, hasVeryQuickPerInputExecution, inputTypesExpected, isInputCompatibleWith
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
TaskWithoutSharedState
public TaskWithoutSharedState()
-
-
Method Details
-
beforeAnyJobIsExecuted
public final NoSharedState beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<T> inputs, ParametersExperiment parameters) throws ExperimentExecutionException Description copied from class:Task
Called once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.- Specified by:
beforeAnyJobIsExecuted
in classTask<T extends InputFromManager,
NoSharedState> - Parameters:
outputter
- the output-manager for the experiment (not for an individual job)concurrencyPlan
- available numbers of processors that can callTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
inputs
- a list of inputs, each will result in at least one call toTask.executeJob(ParametersUnbound)
.parameters
- the experiment-parameters.- Returns:
- the shared-state that is passed to each call to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
and toTask.afterAllJobsAreExecuted(S, org.anchoranalysis.io.output.outputter.InputOutputContext)
. - Throws:
ExperimentExecutionException
- if a fatal error occurs executing this step of the experiment.
-