public interface TaskManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_KEY_MAX_SCALE_UP
configuration setting for max. number of tasks processed on one node.
|
static java.lang.String |
CONFIGURATION_BUNDLE
The configuration bundle.
|
static java.lang.String |
FINISHING_TASKS_WORKER
queue/worker containing tasks to finish.
|
static java.lang.String |
PREFIX_INTERNAL
prefix for internal (worker) queues.
|
static java.lang.String |
TASKERROR_TIME_TO_LIVE
error code used in result descriptions to finish tasks.
|
Modifier and Type | Method and Description |
---|---|
void |
addInProgressTask(Task task) |
void |
addTask(Task task) |
void |
addTaskQueue(java.lang.String workerName) |
void |
addTasks(java.util.Collection<Task> taskList)
add tasks to the system (e.g. for manually triggered tasks).
|
java.util.List<Task> |
filterDuplicates(java.util.List<Task> tasksToBeAdded)
return new list of tasks with only those tasks from the given task list
that do not have property
Task.PROPERTY_UNIQUENESS_TAG set or
for which currently no task is in the Todo queue that has the same uniqueness tag. |
void |
finishTask(java.lang.String workerName,
java.lang.String taskId,
ResultDescription resultDescription)
Remove task from in-progress and put it into finishing queue.
|
void |
finishTasks(java.lang.String workerName,
java.util.Collection<java.lang.String> qualifiers,
ResultDescription resultDescription)
Finish all qualified tasks matching the qualifier condition.
|
long |
getFailSafetyLevel() |
long |
getMaxScaleUp() |
java.util.Map<java.lang.String,java.lang.Integer> |
getScaleUpCounters() |
Task |
getTask(java.lang.String workerName,
java.lang.String host)
Get next task for worker with name workerName.
|
Task |
getTask(java.lang.String workerName,
java.lang.String host,
java.util.Collection<java.lang.String> qualifiers)
Get next task for worker with name workerName that match the given qualifiers.
|
java.util.Map<java.lang.String,TaskCounter> |
getTaskCounters()
Get number of tasks in all current queues.
|
Any |
getTaskInfo(java.lang.String workerName,
java.lang.String section,
java.lang.String taskName)
Prepares information on a task stored in the task storage.
|
TaskList |
getTaskList(java.lang.String workerName,
java.lang.String section,
int maxCount)
Get task list for current task pipe and sub-type.
|
void |
keepAlive(java.lang.String workerName,
java.lang.String taskId)
Prevent rollback of task due to exceeded time-to-live.
|
void |
removeTasks(AnyMap filterMap)
Remove canceled tasks identified by the filter map.
|
void |
updateConfiguration(AnyMap config)
Allows to update the taskmanager configuration, e.g. the maxScaleUp setting.
|
static final java.lang.String PREFIX_INTERNAL
static final java.lang.String CONFIGURATION_BUNDLE
static final java.lang.String TASKERROR_TIME_TO_LIVE
static final java.lang.String FINISHING_TASKS_WORKER
static final java.lang.String CONFIG_KEY_MAX_SCALE_UP
void addTask(Task task) throws TaskmanagerException
task
- the task to add to the todo queue of its worker (contained in task)TaskmanagerException
void addInProgressTask(Task task) throws TaskmanagerException
task
- the task to add to the in progress queue of its worker (contained in task)TaskmanagerException
void addTasks(java.util.Collection<Task> taskList) throws TaskmanagerException
taskList
- the list of tasks to add.TaskmanagerException
Task getTask(java.lang.String workerName, java.lang.String host) throws TaskmanagerException
workerName
- the worker namehost
- the host name where the worker is running that requested the taskTaskmanagerException
- an error while looking up or returning the task for the given worker.Task getTask(java.lang.String workerName, java.lang.String host, java.util.Collection<java.lang.String> qualifiers) throws TaskmanagerException
workerName
- the worker namehost
- the host name where the worker is running that requested the taskqualifiers
- qualifiers to describe the task.TaskmanagerException
- an error while looking up or returning the task for the given worker.void finishTask(java.lang.String workerName, java.lang.String taskId, ResultDescription resultDescription) throws TaskmanagerException
workerName
- the worker nametaskId
- the id of the task to be finishedresultDescription
- the result description for the task to be finished.TaskmanagerException
- an error occurred while trying to finish the task.void finishTasks(java.lang.String workerName, java.util.Collection<java.lang.String> qualifiers, ResultDescription resultDescription) throws TaskmanagerException
workerName
- the worker name.qualifiers
- qualifiers describing the condition. Must not be null. If it is empty, nothing is done.resultDescription
- the result description for the tasks to be finished.TaskmanagerException
- an exception occurred while trying to delete the tasks.void keepAlive(java.lang.String workerName, java.lang.String taskId) throws TaskmanagerException
workerName
- the worker name.taskId
- the ID of the task.TaskmanagerException
- an error occurred while trying to send keep alive for this task.java.util.Map<java.lang.String,TaskCounter> getTaskCounters() throws TaskmanagerException
TaskmanagerException
- counting failsTaskList getTaskList(java.lang.String workerName, java.lang.String section, int maxCount) throws TaskmanagerException
workerName
- name/id as stringsection
- task pipe sub-type: "inprogress" or "todo".maxCount
- max. number of tasks in return listTaskmanagerException
- if accessing task list failsAny getTaskInfo(java.lang.String workerName, java.lang.String section, java.lang.String taskName) throws TaskmanagerException
workerName
- pipe in which the task is storedsection
- queue section ("todo" or "inprogress")taskName
- task identifierTaskmanagerException
- on errorlong getFailSafetyLevel()
java.util.Map<java.lang.String,java.lang.Integer> getScaleUpCounters() throws TaskmanagerException
TaskmanagerException
- on error.long getMaxScaleUp()
void updateConfiguration(AnyMap config) throws TaskmanagerException
TaskmanagerException
void removeTasks(AnyMap filterMap) throws TaskmanagerException
filterMap
- map to identify tasks to be removedTaskmanagerException
- an exception if something went wrongvoid addTaskQueue(java.lang.String workerName) throws TaskmanagerException
workerName
- worker for which to add a task queue with given name.TaskmanagerException
java.util.List<Task> filterDuplicates(java.util.List<Task> tasksToBeAdded) throws TaskmanagerException
Task.PROPERTY_UNIQUENESS_TAG
set or
tasksToBeAdded
- tasks created as follow-up tasks but not yet added to the task managerTaskmanagerException