edu.mssm.crover.ims.tasks.rmi
Interface TaskManagerRMIServer

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
TaskManagerRMIServerImpl

public interface TaskManagerRMIServer
extends java.rmi.Remote

RMI Server interface for TaskManager. This interface provides a limited set of features wich are accessible through RMI. The direct TaskManager API supplements this interface with methods to check the status of a class. Manages the scheduling and execution of tasks by workers. Workers contact a TaskManager to obtain RMITasks. The manager maintains the consistency of the todo list, such that one task is successfully processed only once, all tasks are eventually processed or reported as failed.

See Also:
<{TaskManager}>

Field Summary
static int ONE_DAY
           
static int ONE_HOUR
           
static int ONE_MINUTE
           
static int ONE_WEEK
           
 
Method Summary
 void acceptTask(RMITask task)
          Must be called when task is accepted by a worker.
 void completeTask(RMITask task, TaskResult result)
          Must be called when task is completed by a worker.
 void failTask(RMITask task, java.lang.Exception e)
          Must be called when a worker fails to complete a task.
 TaskResult getTaskResult(java.lang.String taskid)
          Returns the result of a task.
 boolean isTaskCompleted(java.lang.String taskid)
          Test if a task status is completed.
 boolean isTaskFailed(java.lang.String taskid)
          Test if a task status is failed.
 RMITask requestTask(java.lang.String[] worker_types)
          Requests a task.
 void setReadyToStart(RMITask task)
          Notify the task manager that this task is now ready to start.
 void startTask(RMITask task)
          Must be called when task is started by a worker.
 java.lang.String submit(java.lang.String taskEngineClassName, TaskData data, long timeout)
          Submits a new task.
 

Field Detail

ONE_WEEK

static final int ONE_WEEK
See Also:
Constant Field Values

ONE_DAY

static final int ONE_DAY
See Also:
Constant Field Values

ONE_HOUR

static final int ONE_HOUR
See Also:
Constant Field Values

ONE_MINUTE

static final int ONE_MINUTE
See Also:
Constant Field Values
Method Detail

getTaskResult

TaskResult getTaskResult(java.lang.String taskid)
                         throws TaskNotFoundException,
                                java.rmi.RemoteException
Returns the result of a task. After a task has completed, this method returns the result computed by the task. If the task has not yet completed, or has failed, this method return null.

Parameters:
taskid - Identifier of the task.
Throws:
TaskNotFoundException
java.rmi.RemoteException

failTask

void failTask(RMITask task,
              java.lang.Exception e)
              throws java.rmi.RemoteException
Must be called when a worker fails to complete a task.

Throws:
java.rmi.RemoteException

completeTask

void completeTask(RMITask task,
                  TaskResult result)
                  throws java.rmi.RemoteException
Must be called when task is completed by a worker.

Throws:
java.rmi.RemoteException

startTask

void startTask(RMITask task)
               throws java.rmi.RemoteException
Must be called when task is started by a worker.

Throws:
java.rmi.RemoteException

setReadyToStart

void setReadyToStart(RMITask task)
                     throws java.rmi.RemoteException
Notify the task manager that this task is now ready to start. The status cannot be changed back later as a task which is ready to start can be started at any time.

Throws:
java.rmi.RemoteException

acceptTask

void acceptTask(RMITask task)
                throws java.rmi.RemoteException
Must be called when task is accepted by a worker.

Throws:
java.rmi.RemoteException

isTaskCompleted

boolean isTaskCompleted(java.lang.String taskid)
                        throws TaskNotFoundException,
                               java.rmi.RemoteException
Test if a task status is completed.

Throws:
TaskNotFoundException
java.rmi.RemoteException

isTaskFailed

boolean isTaskFailed(java.lang.String taskid)
                     throws TaskNotFoundException,
                            java.rmi.RemoteException
Test if a task status is failed.

Throws:
TaskNotFoundException
java.rmi.RemoteException

requestTask

RMITask requestTask(java.lang.String[] worker_types)
                    throws java.lang.ClassNotFoundException,
                           java.lang.InstantiationException,
                           java.lang.IllegalAccessException,
                           java.rmi.RemoteException
Requests a task. This method checks that a TaskEngine can be instanciated for each worker type submitted. This makes sure specific classes of the TaskEngines are in the classpath before the task is requested from the TaskManager and should avoid tasks failed because of incorrect classpath configurations.

Throws:
java.lang.ClassNotFoundException - When the class of the TaskEngine corresponding to a given worker_type cannot be found.
java.lang.InstantiationException - When the TaskEngine corresponding to a given worker_type cannot be instanciated.
java.lang.IllegalAccessException - When the TaskEngine constructor cannot be accessed.
java.rmi.RemoteException
See Also:
<{TaskManager}>

submit

java.lang.String submit(java.lang.String taskEngineClassName,
                        TaskData data,
                        long timeout)
                        throws java.rmi.RemoteException
Submits a new task.

Parameters:
taskEngineClassName - Name of the class for the TaskEngine that will process this class.
data - Instance of TaskData that contains the data used to initialize this task.
Returns:
task-id Task identifier used to inquire about the task after submission.
Throws:
java.rmi.RemoteException


Copyright © 2003-2013 Institute for Computational Biomedicine, All Rights Reserved.