org.globus.cog.karajan.scheduler
Class LateBindingScheduler

java.lang.Object
  extended by java.lang.Thread
      extended by org.globus.cog.karajan.scheduler.AbstractScheduler
          extended by org.globus.cog.karajan.scheduler.LateBindingScheduler
All Implemented Interfaces:
Runnable, StatusListener, Scheduler
Direct Known Subclasses:
DefaultScheduler, ThrottlingScheduler, WeightedHostScoreScheduler

public abstract class LateBindingScheduler
extends AbstractScheduler
implements StatusListener


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_JOBS_PER_CPU
           
static int DEFAULT_MAX_FILE_OPERATIONS
           
static int DEFAULT_MAX_TRANSFERS
           
static int DEFAULT_SSH_INITIAL_RATE
           
protected  Map executionHandlers
           
static String HOST_SUBMIT_THROTTLE
           
static String JOBS_PER_CPU
           
static int K
           
static String MAX_FILE_OPERATIONS
           
static String MAX_TRANSFERS
           
static String[] propertyNames
           
static String SSH_INITIAL_RATE
           
static String SUBMIT_THROTTLE
           
static int THREAD_STACK_SIZE
           
 
Fields inherited from class org.globus.cog.karajan.scheduler.AbstractScheduler
THROTTLE_OFF
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LateBindingScheduler()
           
 
Method Summary
 Contact allocateContact()
          Attempt to allocate a host.
 Contact allocateContact(Object constraints)
           
 void cancelTask(Task task)
          Prematurely terminates a task that is either enqueued or running
 boolean checkFreeMemory()
           
protected  void checkGlobalLoadConditions()
           
protected  boolean checkLoad(BoundContact contact)
           
protected  void checkTaskLoadConditions(Task t)
           
protected  int decRunning()
           
 void enqueue(Task task, Object constraints)
          Adds a task to the queue.
protected  void failTask(Task t, String message, Exception e)
           
 TaskHandler findTaskHandler(Task task, Service[] services)
           
protected  Contact[] getContacts(Task t)
           
protected  TaskHandler getHandler(Task t)
           
 int getHandlerType(int taskType)
           
protected  int getJobsPerCPU()
           
protected  BoundContact getNextContact(Task t)
           
protected abstract  BoundContact getNextContact(TaskConstraints constraints)
           
 String[] getPropertyNames()
           
 int getRunning()
           
 InstanceSubmitQueue getSubmitQueue()
           
protected  TaskConstraints getTaskConstraints(Task t)
           
 HashMap getVirtualContacts()
           
protected  int incRunning()
           
 boolean isDone()
           
 void releaseContact(Contact contact)
          Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.
protected  void removeHandler(Task t)
           
 BoundContact resolveContact(Task t, Contact contact)
           
 Service resolveService(BoundContact contact, int taskType)
           
 BoundContact resolveVirtualContact(Contact contact)
           
 void run()
           
protected  void setHandler(Task t, TaskHandler th)
           
 void setProperty(String name, Object value)
          Sets a scheduler property.
 void setVirtualContacts(HashMap virtualContacts)
           
 void statusChanged(StatusEvent e)
           
 void submitBoundToServices(Task t, Contact[] contacts, Service[] services)
           
 void terminate()
           
 
Methods inherited from class org.globus.cog.karajan.scheduler.AbstractScheduler
addFailureHandler, addJobStatusListener, addTaskHandler, addTaskTransformer, applyTaskTransformers, checkConstraints, checkConstraints, combineNames, fireJobStatusChangeEvent, fireJobStatusChangeEvent, getConstraintChecker, getConstraints, getJobQueue, getMaxSimultaneousJobs, getProperty, getResources, getTaskHadlerWrapper, getTaskHandlers, getTaskHandlerWrapper, getTaskHandlerWrappers, getTaskTransformers, removeConstraints, removeJobStatusListener, runFailureHandlers, setConstraintChecker, setConstraints, setMaxSimultaneousJobs, setResources, setTaskHandlers, throttleValue
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JOBS_PER_CPU

public static final String JOBS_PER_CPU
See Also:
Constant Field Values

HOST_SUBMIT_THROTTLE

public static final String HOST_SUBMIT_THROTTLE
See Also:
Constant Field Values

SUBMIT_THROTTLE

public static final String SUBMIT_THROTTLE
See Also:
Constant Field Values

MAX_TRANSFERS

public static final String MAX_TRANSFERS
See Also:
Constant Field Values

SSH_INITIAL_RATE

public static final String SSH_INITIAL_RATE
See Also:
Constant Field Values

MAX_FILE_OPERATIONS

public static final String MAX_FILE_OPERATIONS
See Also:
Constant Field Values

K

public static final int K
See Also:
Constant Field Values

THREAD_STACK_SIZE

public static final int THREAD_STACK_SIZE
See Also:
Constant Field Values

DEFAULT_SSH_INITIAL_RATE

public static final int DEFAULT_SSH_INITIAL_RATE
See Also:
Constant Field Values

DEFAULT_JOBS_PER_CPU

public static final int DEFAULT_JOBS_PER_CPU
See Also:
Constant Field Values

DEFAULT_MAX_TRANSFERS

public static final int DEFAULT_MAX_TRANSFERS
See Also:
Constant Field Values

DEFAULT_MAX_FILE_OPERATIONS

public static final int DEFAULT_MAX_FILE_OPERATIONS
See Also:
Constant Field Values

executionHandlers

protected final Map executionHandlers

propertyNames

public static String[] propertyNames
Constructor Detail

LateBindingScheduler

public LateBindingScheduler()
Method Detail

allocateContact

public Contact allocateContact(Object constraints)
                        throws NoFreeResourceException
Specified by:
allocateContact in interface Scheduler
Throws:
NoFreeResourceException

allocateContact

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

Specified by:
allocateContact in interface Scheduler
Throws:
NoFreeResourceException

releaseContact

public void releaseContact(Contact contact)
Description copied from interface: Scheduler
Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.

Specified by:
releaseContact in interface Scheduler

resolveVirtualContact

public BoundContact resolveVirtualContact(Contact contact)
                                   throws NoFreeResourceException
Throws:
NoFreeResourceException

getVirtualContacts

public HashMap getVirtualContacts()

setVirtualContacts

public void setVirtualContacts(HashMap virtualContacts)

getNextContact

protected abstract BoundContact getNextContact(TaskConstraints constraints)
                                        throws NoFreeResourceException
Throws:
NoFreeResourceException

getNextContact

protected BoundContact getNextContact(Task t)
                               throws NoFreeResourceException
Throws:
NoFreeResourceException

getTaskConstraints

protected TaskConstraints getTaskConstraints(Task t)

enqueue

public void enqueue(Task task,
                    Object constraints)
Description copied from interface: Scheduler
Adds a task to the queue.

Specified by:
enqueue in interface Scheduler
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

isDone

public boolean isDone()

getRunning

public int getRunning()

checkGlobalLoadConditions

protected void checkGlobalLoadConditions()
                                  throws NoFreeResourceException
Throws:
NoFreeResourceException

checkTaskLoadConditions

protected void checkTaskLoadConditions(Task t)
                                throws NoFreeResourceException
Throws:
NoFreeResourceException

checkFreeMemory

public boolean checkFreeMemory()

incRunning

protected int incRunning()

decRunning

protected int decRunning()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

terminate

public void terminate()

failTask

protected void failTask(Task t,
                        String message,
                        Exception e)

resolveContact

public BoundContact resolveContact(Task t,
                                   Contact contact)
                            throws NoFreeResourceException
Throws:
NoFreeResourceException

resolveService

public Service resolveService(BoundContact contact,
                              int taskType)

getHandlerType

public int getHandlerType(int taskType)

findTaskHandler

public TaskHandler findTaskHandler(Task task,
                                   Service[] services)
                            throws TaskSubmissionException,
                                   InvalidProviderException,
                                   ProviderMethodException
Throws:
TaskSubmissionException
InvalidProviderException
ProviderMethodException

submitBoundToServices

public void submitBoundToServices(Task t,
                                  Contact[] contacts,
                                  Service[] services)
                           throws TaskSubmissionException
Throws:
TaskSubmissionException

getSubmitQueue

public InstanceSubmitQueue getSubmitQueue()

getJobsPerCPU

protected int getJobsPerCPU()

getHandler

protected TaskHandler getHandler(Task t)

setHandler

protected void setHandler(Task t,
                          TaskHandler th)

removeHandler

protected void removeHandler(Task t)

setProperty

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

Specified by:
setProperty in interface Scheduler
Overrides:
setProperty in class AbstractScheduler

statusChanged

public void statusChanged(StatusEvent e)
Specified by:
statusChanged in interface StatusListener

cancelTask

public void cancelTask(Task task)
Description copied from interface: Scheduler
Prematurely terminates a task that is either enqueued or running

Specified by:
cancelTask in interface Scheduler

checkLoad

protected boolean checkLoad(BoundContact contact)
                     throws NoFreeResourceException
Throws:
NoFreeResourceException

getPropertyNames

public String[] getPropertyNames()
Specified by:
getPropertyNames in interface Scheduler
Overrides:
getPropertyNames in class AbstractScheduler

getContacts

protected Contact[] getContacts(Task t)