org.globus.cog.karajan.scheduler
Interface Scheduler

All Known Implementing Classes:
AbstractScheduler, DefaultScheduler, StaticContactListScheduler

public interface Scheduler


Method Summary
 void addJobStatusListener(StatusListener l, Task task)
          Allows the addition of a status listener that will be invoked whenever the status of the given task changes.
 void addTaskHandler(TaskHandlerWrapper taskHandler)
          Makes the scheduler aware of a task handler implementation.
 Contact allocateContact()
          Attempt to allocate a host.
 void cancelTask(Task task)
          Prematurely terminates a task that is either enqueued or running
 void enqueue(Task task, Object constraints)
          Adds a task to the queue.
 String[] getPropertyNames()
           
 ContactSet getResources()
          Returns the set of resources that the scheduler knows about
 List getTaskHandlers()
          Returns a list of all the task handlers that were added to the scheduler
 void releaseContact(BoundContact sc)
          Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.
 void removeJobStatusListener(StatusListener l, Task task)
          Removes a status listener added using addJobStatusListener
 void setProperty(String name, Object value)
          Sets a scheduler property.
 void setResources(ContactSet resources)
          Sets the set of resources that the scheduler will use
 

Method Detail

enqueue

public void enqueue(Task task,
                    Object constraints)
Adds a task to the queue.

Parameters:
constraints - Can be used to specify constraints under which the task should be scheduler. While the semantics of the constraints are left to the implementation, such an implementation should be able to handle at least constraints of the type Contact.
See Also:
org.globus.karajan.util.Contact

allocateContact

public Contact allocateContact()
                        throws NoFreeResourceException
Attempt to allocate a host. The returned object should be used later by the requestor as a constraint while enqueuing a task.

Throws:
NoFreeResourceException

releaseContact

public void releaseContact(BoundContact sc)
Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.


setResources

public void setResources(ContactSet resources)
Sets the set of resources that the scheduler will use

See Also:
ContactSet

getResources

public ContactSet getResources()
Returns the set of resources that the scheduler knows about


addJobStatusListener

public void addJobStatusListener(StatusListener l,
                                 Task task)
Allows the addition of a status listener that will be invoked whenever the status of the given task changes.


removeJobStatusListener

public void removeJobStatusListener(StatusListener l,
                                    Task task)
Removes a status listener added using addJobStatusListener


addTaskHandler

public void addTaskHandler(TaskHandlerWrapper taskHandler)
Makes the scheduler aware of a task handler implementation. The scheduler can then make use of any of the task handlers that were added.

See Also:
TaskHandlerWrapper

getTaskHandlers

public List getTaskHandlers()
Returns a list of all the task handlers that were added to the scheduler


setProperty

public void setProperty(String name,
                        Object value)
Sets a scheduler property. The supported property names can be queried using the getPropertyNames method


getPropertyNames

public String[] getPropertyNames()

cancelTask

public void cancelTask(Task task)
Prematurely terminates a task that is either enqueued or running