Class Task<T extends InputFromManager,S>
- Type Parameters:
T
- input-object typeS
- shared-state type
- Direct Known Subclasses:
AggregateAnnotations
,CombineCSV
,CompareAnnotations
,ConvertNamedChannels
,CopyFiles
,ExportFeatures
,ExtractSlice
,GroupedStackBase
,ImageAssignLabel
,Montage
,RasterTask
,ScaleImage
,SegmentInstanceWithModel
,SummarizeBase
,TaskWithoutSharedState
Encapsulates some kind of processing to be performed on a set of inputs.
A shared-state is created which is then available as common state across all inputs. We
avoid remembering state on a field in Task
itself, so that the Task
itself can be
freely duplicated across nodes when parallelizing processing.
Initially ParametersUnbound
are created as task-wide parameters across inputs, whereas
InputBound
are created in a further step, specific to each input.
e.g. we move from a logger for the experiment as a whole in ParametersUnbound
, to a
logger for the task itself in InputBound
.
The following outputs are produced, and depending on parameterization, written to the file-system:
Output Name | Default? | Description |
---|---|---|
outputs from InputOutputExperiment . |
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
afterAllJobsAreExecuted
(S sharedState, InputOutputContext context) Called once after all calls toexecuteJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.abstract S
beforeAnyJobIsExecuted
(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<T> inputs, ParametersExperiment parameters) Called once before all calls toexecuteJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.If specified, default rules for determine which outputs are enabled or not.abstract void
doJobOnInput
(InputBound<T, S> input) Performs the task on a particular input.boolean
executeJob
(ParametersUnbound<T, S> parametersUnbound) Runs the task on one particular input (a job).abstract boolean
Is the execution-time of the task per-input expected to be very quick to execute?abstract InputTypesExpected
Highest class(es) that will function as a valid input.boolean
isInputCompatibleWith
(Class<? extends InputFromManager> inputClass) Is an input-object type compatible with this particular task?Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
Task
public Task()
-
-
Method Details
-
hasVeryQuickPerInputExecution
public abstract boolean hasVeryQuickPerInputExecution()Is the execution-time of the task per-input expected to be very quick to execute?- Returns:
- true iff the execution is expected to be very quick, false otherwise.
-
beforeAnyJobIsExecuted
public abstract S beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<T> inputs, ParametersExperiment parameters) throws ExperimentExecutionException Called once before all calls toexecuteJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.- Parameters:
outputter
- the output-manager for the experiment (not for an individual job)concurrencyPlan
- available numbers of processors that can callexecuteJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
inputs
- a list of inputs, each will result in at least one call toexecuteJob(ParametersUnbound)
.parameters
- the experiment-parameters.- Returns:
- the shared-state that is passed to each call to
executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
and toafterAllJobsAreExecuted(S, org.anchoranalysis.io.output.outputter.InputOutputContext)
. - Throws:
ExperimentExecutionException
- if a fatal error occurs executing this step of the experiment.
-
executeJob
Runs the task on one particular input (a job).- Parameters:
parametersUnbound
- parameters for the input (unbound to any output location).- Returns:
- whether the job finished successfully or not.
- Throws:
JobExecutionException
- if anything goes wrong with the job which is not logged.
-
afterAllJobsAreExecuted
public abstract void afterAllJobsAreExecuted(S sharedState, InputOutputContext context) throws ExperimentExecutionException Called once after all calls toexecuteJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.- Parameters:
sharedState
- the shared-statecontext
- IO-context for experiment (not for an individual job)- Throws:
ExperimentExecutionException
- if a fatal error occurs executing this step of the experiment.
-
isInputCompatibleWith
Is an input-object type compatible with this particular task?- Parameters:
inputClass
- the class of the input-object type to be queried.- Returns:
- true if the input-object type is compatible with the current task, false otherwise.
-
inputTypesExpected
Highest class(es) that will function as a valid input.This is usually the class of T (or sometimes the absolute base class InputFromManager).
- Returns:
- the input-types that a task expects.
-
doJobOnInput
Performs the task on a particular input.- Parameters:
input
- the input for the job.- Throws:
JobExecutionException
- if an error occurs executing a particular job, that is not otherwise suppressed.
-
defaultOutputs
If specified, default rules for determine which outputs are enabled or not.- Returns:
- the default rules if they exist.
-