Class AbstractTaskScheduler
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.core.schedulers.AbstractTaskScheduler
-
- All Implemented Interfaces:
TaskScheduler
- Direct Known Subclasses:
AbstractClusterTaskScheduler,HadoopCompatibleTaskScheduler,MonoThreadTaskScheduler,MultiThreadTaskScheduler
public abstract class AbstractTaskScheduler extends Object implements TaskScheduler
This class define an abstract task scheduler.- Since:
- 2.0
- Author:
- Laurent Jourdren
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTaskScheduler()Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecuteTask(TaskContextImpl context, TaskResultImpl result)Set the state of the context after executing a task.protected voidbeforeExecuteTask(TaskContextImpl context)Set the state of the context before executing a task.protected TaskResultImplexecuteTask(TaskContextImpl context)Default executing context method.StepResultgetResult(Step step)Get the result related to a step.StepStatusgetStatus(Step step)Get the status related to a step.protected StepgetStep(int contextId)Get the step related to a context.protected StepgetStep(TaskContextImpl context)Get the step related to a context.intgetTaskDoneCount(Step step)Get the count of done task contexts of a step.intgetTaskRunningCount(Step step)Get the count of running task contexts of a step.intgetTaskSubmittedCount(Step step)Get the count of submitted task contexts of a step.intgetTotalTaskDoneCount()Get the count of done task contexts for the workflow.intgetTotalTaskRunningCount()Get the count of running task contexts for the workflow.intgetTotalTaskSubmittedCount()Get the count of submitted task contexts for the workflow.protected booleanisStarted()protected booleanisStopped()voidstart()Start the scheduler.voidstop()Stop the scheduler.voidsubmit(Step step, TaskContextImpl context)Submit a context to execute.voidsubmit(Step step, Set<TaskContextImpl> contexts)Submit contexts to execute.voidwaitEndOfTasks(Step step)Wait the end of the task contexts.
-
-
-
Method Detail
-
getStep
protected Step getStep(TaskContextImpl context)
Get the step related to a context.- Parameters:
context- the context- Returns:
- the step related to the context
-
getStep
protected Step getStep(int contextId)
Get the step related to a context.- Parameters:
contextId- the context id- Returns:
- the step related to the context
-
beforeExecuteTask
protected void beforeExecuteTask(TaskContextImpl context)
Set the state of the context before executing a task.- Parameters:
context- the context to execute
-
afterExecuteTask
protected void afterExecuteTask(TaskContextImpl context, TaskResultImpl result)
Set the state of the context after executing a task.- Parameters:
context- the context to execute
-
executeTask
protected TaskResultImpl executeTask(TaskContextImpl context)
Default executing context method.- Parameters:
context- the context- Returns:
- a TaskResult object
-
submit
public void submit(Step step, Set<TaskContextImpl> contexts)
Description copied from interface:TaskSchedulerSubmit contexts to execute.- Specified by:
submitin interfaceTaskScheduler- Parameters:
step- step related to the contextscontexts- contexts to execute
-
submit
public void submit(Step step, TaskContextImpl context)
Description copied from interface:TaskSchedulerSubmit a context to execute.- Specified by:
submitin interfaceTaskScheduler- Parameters:
step- step related to the contextcontext- context to execute
-
getStatus
public StepStatus getStatus(Step step)
Description copied from interface:TaskSchedulerGet the status related to a step.- Specified by:
getStatusin interfaceTaskScheduler- Parameters:
step- a workflow step- Returns:
- the step status object related to the step
-
getResult
public StepResult getResult(Step step)
Description copied from interface:TaskSchedulerGet the result related to a step.- Specified by:
getResultin interfaceTaskScheduler- Parameters:
step- a workflow step- Returns:
- the step result object related to the step
-
getTaskSubmittedCount
public int getTaskSubmittedCount(Step step)
Description copied from interface:TaskSchedulerGet the count of submitted task contexts of a step.- Specified by:
getTaskSubmittedCountin interfaceTaskScheduler- Parameters:
step- a workflow step- Returns:
- the count of submitted task contexts
-
getTaskRunningCount
public int getTaskRunningCount(Step step)
Description copied from interface:TaskSchedulerGet the count of running task contexts of a step.- Specified by:
getTaskRunningCountin interfaceTaskScheduler- Parameters:
step- a workflow step- Returns:
- the count of running task contexts
-
getTaskDoneCount
public int getTaskDoneCount(Step step)
Description copied from interface:TaskSchedulerGet the count of done task contexts of a step.- Specified by:
getTaskDoneCountin interfaceTaskScheduler- Parameters:
step- a workflow step- Returns:
- the count of done task contexts
-
getTotalTaskSubmittedCount
public int getTotalTaskSubmittedCount()
Description copied from interface:TaskSchedulerGet the count of submitted task contexts for the workflow.- Specified by:
getTotalTaskSubmittedCountin interfaceTaskScheduler- Returns:
- the count of submitted task contexts
-
getTotalTaskRunningCount
public int getTotalTaskRunningCount()
Description copied from interface:TaskSchedulerGet the count of running task contexts for the workflow.- Specified by:
getTotalTaskRunningCountin interfaceTaskScheduler- Returns:
- the count of running task contexts
-
getTotalTaskDoneCount
public int getTotalTaskDoneCount()
Description copied from interface:TaskSchedulerGet the count of done task contexts for the workflow.- Specified by:
getTotalTaskDoneCountin interfaceTaskScheduler- Returns:
- the count of done task contexts
-
waitEndOfTasks
public void waitEndOfTasks(Step step)
Description copied from interface:TaskSchedulerWait the end of the task contexts.- Specified by:
waitEndOfTasksin interfaceTaskScheduler- Parameters:
step- a workflow step
-
start
public void start()
Description copied from interface:TaskSchedulerStart the scheduler.- Specified by:
startin interfaceTaskScheduler
-
isStarted
protected boolean isStarted()
-
stop
public void stop()
Description copied from interface:TaskSchedulerStop the scheduler.- Specified by:
stopin interfaceTaskScheduler
-
isStopped
protected boolean isStopped()
-
-