Class ChainTask
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields inherited from class nz.org.riskscape.engine.task.WorkerTask
contextSwitches, id, in, out, pageReader, pageWriter, processingResult, runtime, runtimeAverage, spec -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Override this method to clean up any resources that were allocated/created by this task for use during execution.booleanReturns true if the task currently has a page of either input or output that it hasn't finished with yet.booleanReturns true if the task has work it can do.booleanrun()Processes the work that the task has to do.Methods inherited from class nz.org.riskscape.engine.task.WorkerTask
consumeProcessingResult, getContext, getFirstStep, getFirstStepRealizedResult, getLastStep, getName, getPageReader, getPageWriter, getSpec, hasInputPage, hasOutputPage, isComplete, isCreated, isInputReady, isOutputReady, isStarted, markComplete, markStarted, runPublic, taskComplete, toString
-
Constructor Details
-
ChainTask
- Throws:
nz.org.riskscape.problem.ProblemException
-
-
Method Details
-
hasPageInProgress
public boolean hasPageInProgress()Description copied from class:WorkerTaskReturns true if the task currently has a page of either input or output that it hasn't finished with yet.
- Overrides:
hasPageInProgressin classWorkerTask
-
isReadyToRun
public boolean isReadyToRun()Description copied from class:WorkerTaskReturns true if the task has work it can do. Returns false if the task is blocked waiting on either more input, more output buffers to free up, or it's dependent on other tasks that haven't completed yet.
- Overrides:
isReadyToRunin classWorkerTask
-
run
Description copied from class:WorkerTaskProcesses the work that the task has to do. The task doesn't necessarily run to completion in one go - it's likely that the task will run out of input or output first, so it'll need to keep coming back and chipping away at the work.
- Specified by:
runin classWorkerTask
-
close
public void close()Description copied from class:WorkerTaskOverride this method to clean up any resources that were allocated/created by this task for use during execution. Will be called from the scheduler once the task has signaled it is complete, but it may also get called if a job that this task was part of has failed.
Thread safety should be ensured by requiring the scheduler to only call close on a task that is not currently being run.
Implementations shouldn't need to do any buffer management in this method, it's meant for closing things like
TupleIterators or other sorts of resources that follow theCloseablepattern.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classWorkerTask
-
producesResult
public boolean producesResult()- Specified by:
producesResultin classWorkerTask
-
getLastOperation
-
getSpecNameBrief
- Overrides:
getSpecNameBriefin classWorkerTask- Returns:
- a unique name for the worker's TaskSpec that is brief and user-friendly. This can be used as a simple way to represent the work that this task is doing to the user.
-
getOperations
-