SMILA 1.0 API documentation

org.eclipse.smila.taskmanager
Interface TaskManager

All Known Implementing Classes:
TaskManagerImpl

public interface TaskManager

The TaskManager.


Field Summary
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.
 
Method Summary
 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).
 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.
 

Field Detail

PREFIX_INTERNAL

static final java.lang.String PREFIX_INTERNAL
prefix for internal (worker) queues.

See Also:
Constant Field Values

CONFIGURATION_BUNDLE

static final java.lang.String CONFIGURATION_BUNDLE
The configuration bundle.

See Also:
Constant Field Values

TASKERROR_TIME_TO_LIVE

static final java.lang.String TASKERROR_TIME_TO_LIVE
error code used in result descriptions to finish tasks.

See Also:
Constant Field Values

FINISHING_TASKS_WORKER

static final java.lang.String FINISHING_TASKS_WORKER
queue/worker containing tasks to finish.

See Also:
Constant Field Values
Method Detail

addTask

void addTask(Task task)
             throws TaskmanagerException
Parameters:
task - the task to add to the todo queue of its worker (contained in task)
Throws:
TaskmanagerException

addInProgressTask

void addInProgressTask(Task task)
                       throws TaskmanagerException
Parameters:
task - the task to add to the in progress queue of its worker (contained in task)
Throws:
TaskmanagerException

addTasks

void addTasks(java.util.Collection<Task> taskList)
              throws TaskmanagerException
add tasks to the system (e.g. for manually triggered tasks).

Parameters:
taskList - the list of tasks to add.
Throws:
TaskmanagerException

getTask

Task getTask(java.lang.String workerName,
             java.lang.String host)
             throws TaskmanagerException
Get next task for worker with name workerName.

Parameters:
workerName - the worker name
host - the host name where the worker is running that requested the task
Returns:
next task for worker with name workerName
Throws:
TaskmanagerException - an error while looking up or returning the task for the given worker.

getTask

Task getTask(java.lang.String workerName,
             java.lang.String host,
             java.util.Collection<java.lang.String> qualifiers)
             throws TaskmanagerException
Get next task for worker with name workerName that match the given qualifiers.

Parameters:
workerName - the worker name
host - the host name where the worker is running that requested the task
qualifiers - qualifiers to describe the task.
Returns:
Next task for worker with name workerName that match the given qualifiers.
Throws:
TaskmanagerException - an error while looking up or returning the task for the given worker.

finishTask

void finishTask(java.lang.String workerName,
                java.lang.String taskId,
                ResultDescription resultDescription)
                throws TaskmanagerException
Remove task from in-progress and put it into finishing queue.

Parameters:
workerName - the worker name
taskId - the id of the task to be finished
resultDescription - the result description for the task to be finished.
Throws:
TaskmanagerException - an error occurred while trying to finish the task.

finishTasks

void finishTasks(java.lang.String workerName,
                 java.util.Collection<java.lang.String> qualifiers,
                 ResultDescription resultDescription)
                 throws TaskmanagerException
Finish all qualified tasks matching the qualifier condition. Lock qualifiers

Parameters:
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.
Throws:
TaskmanagerException - an exception occurred while trying to delete the tasks.

keepAlive

void keepAlive(java.lang.String workerName,
               java.lang.String taskId)
               throws TaskmanagerException
Prevent rollback of task due to exceeded time-to-live.

Parameters:
workerName - the worker name.
taskId - the ID of the task.
Throws:
TaskmanagerException - an error occurred while trying to send keep alive for this task.

getTaskCounters

java.util.Map<java.lang.String,TaskCounter> getTaskCounters()
                                                            throws TaskmanagerException
Get number of tasks in all current queues.

Returns:
task counters
Throws:
TaskmanagerException - counting fails

getTaskList

TaskList getTaskList(java.lang.String workerName,
                     java.lang.String section,
                     int maxCount)
                     throws TaskmanagerException
Get task list for current task pipe and sub-type.

Parameters:
workerName - name/id as string
section - task pipe sub-type: "inprogress" or "todo".
maxCount - max. number of tasks in return list
Returns:
task list
Throws:
TaskmanagerException - if accessing task list fails

getTaskInfo

Any getTaskInfo(java.lang.String workerName,
                java.lang.String section,
                java.lang.String taskName)
                throws TaskmanagerException
Prepares information on a task stored in the task storage.

Parameters:
workerName - pipe in which the task is stored
section - queue section ("todo" or "inprogress")
taskName - task identifier
Returns:
task information
Throws:
TaskmanagerException - on error

getFailSafetyLevel

long getFailSafetyLevel()
Returns:
number of nodes that may fail before tasks get lost.

getScaleUpCounters

java.util.Map<java.lang.String,java.lang.Integer> getScaleUpCounters()
                                                                     throws TaskmanagerException
Returns:
number of tasks in progress on different hosts.
Throws:
TaskmanagerException - on error.

getMaxScaleUp

long getMaxScaleUp()
Returns:
maximum number of tasks that should be delivered to a host. (scale up control)

removeTasks

void removeTasks(AnyMap filterMap)
                 throws TaskmanagerException
Remove canceled tasks identified by the filter map.

Parameters:
filterMap - map to identify tasks to be removed
Throws:
TaskmanagerException - an exception if something went wrong

addTaskQueue

void addTaskQueue(java.lang.String workerName)
                  throws TaskmanagerException
Parameters:
workerName - worker for which to add a task queue with given name.
Throws:
TaskmanagerException

SMILA 1.0 API documentation