org.gridbus.broker.common
Class Scheduler

java.lang.Object
  extended by org.gridbus.broker.common.Scheduler
All Implemented Interfaces:
java.lang.Runnable, JobListener
Direct Known Subclasses:
DBDataScheduler, DBScheduler, GroupingParameterSweepScheduler, ParameterSweepScheduler, RoundRobinScheduler

public abstract class Scheduler
extends java.lang.Object
implements java.lang.Runnable, JobListener

This is the base scheduler class, and contains main methods for performing the scheduling

Author:
Srikumar Venugopal (srikumar@csse.unimelb.edu.au), Krishna Nadiminti (kna@csse.unimelb.edu.au)

Field Summary
protected  java.lang.String applicationID
           
protected  boolean failed
           
protected  boolean feasible
           
protected  boolean finished
           
protected  int numPoll
           
protected  long pollTime
           
protected  BrokerStorage store
           
protected  long timeStart
           
protected  JobStatistics totalStats
           
protected  boolean userMarketDir
           
protected  boolean useSoftwareCost
           
 
Constructor Summary
Scheduler(java.lang.String applicationID)
          Constructor for the Scheduler
 
Method Summary
protected  void freeQueueSlot(Job job)
           
protected  java.util.List getCandidateSCSServers(org.gridbus.scs.common.SCSJob job)
           
protected  java.util.List getCandidateServers(Job job)
           
protected  void getJobStatsFromStore()
          Gets the job stats into counters in memory
 java.lang.String getKey()
          Returns the name of the scheduler
protected  Job getNextReadyJob()
           
protected  org.gridbus.scs.common.SCSJob getNextReadySCSJob()
           
 long getPollTime()
           
protected  java.util.List getReadyServers()
           
protected  void groupServers(java.util.ArrayList grpSrvLst, java.util.List servers)
          Groups the servers into an arrayList of vectors based on their pricePerJob
protected  boolean isClassValid()
          Returns if the current class is a valid one.
 boolean isFailed()
           
 boolean isFeasible()
           
 boolean isFinished()
          Returns whether the scheduling is finished.
protected  boolean isJobRequirementMet(Job job, ComputeServer server)
           
protected  boolean isSCSJobRequirementMet(org.gridbus.scs.common.SCSJob job, ComputeServer server)
           
 void jobReset(Job job)
          Job is reset
 void run()
          The run method enables the scheduler to run as a seperate thread, and calls the 'schedule()' method.
protected  boolean saveJobMapping(Job job, ComputeServer server)
          Maps the given job to the given server.
protected  boolean saveJobMapping(org.gridbus.scs.common.SCSJob job, ComputeServer server)
           
protected  void saveStatusEvent(Job job)
           
protected  void saveStatusEvent(org.gridbus.scs.common.SCSJob job)
           
protected abstract  void schedule()
          Abstract method: schedule to be implemented by derived classes which implement various scheduling algorithms.
protected  void setFailed()
           
protected  void setFeasible(boolean feasible)
           
protected  void setFinished()
          Sets the 'finished' state of the scheduler.
protected  void sortByCost(java.util.List servers)
          Sorts the compute server list by cost (ascending order: cheapest first)
protected  void sortByRunningJobs(java.util.List servers)
          Sorts the compute server list by running jobs (ascending order of running jobs)
protected  void sortByTime(java.util.List servers)
          Sorts the compute server list by time (ascending order of job-computation time: fastest first)
 void statusChanged(Job job)
          Status changed event for a Job
 void statusChanged(org.gridbus.scs.common.SCSJob job)
          SCS Job : Tom
protected  void updateJobStatus(Job job, int status)
           
protected  void updateQos(Qos qos, float budgetspent, long timespent)
          Wrapper method for derived scheduler to update the qos
protected  void updateServerPerformance(Job job)
           
protected  void updateStats()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationID

protected java.lang.String applicationID

store

protected BrokerStorage store

totalStats

protected JobStatistics totalStats

pollTime

protected long pollTime

numPoll

protected int numPoll

finished

protected boolean finished

failed

protected boolean failed

feasible

protected boolean feasible

useSoftwareCost

protected boolean useSoftwareCost

userMarketDir

protected boolean userMarketDir

timeStart

protected long timeStart
Constructor Detail

Scheduler

public Scheduler(java.lang.String applicationID)
          throws GridBrokerException
Constructor for the Scheduler

Parameters:
applicationID -
Throws:
GridBrokerException
Method Detail

getKey

public final java.lang.String getKey()
Returns the name of the scheduler

Returns:
name

sortByTime

protected void sortByTime(java.util.List servers)
Sorts the compute server list by time (ascending order of job-computation time: fastest first)

Parameters:
servers -

sortByRunningJobs

protected void sortByRunningJobs(java.util.List servers)
Sorts the compute server list by running jobs (ascending order of running jobs)

Parameters:
servers -

sortByCost

protected void sortByCost(java.util.List servers)
Sorts the compute server list by cost (ascending order: cheapest first)

Parameters:
servers -

groupServers

protected void groupServers(java.util.ArrayList grpSrvLst,
                            java.util.List servers)
Groups the servers into an arrayList of vectors based on their pricePerJob

Parameters:
grpSrvLst -
servers -

getJobStatsFromStore

protected void getJobStatsFromStore()
                             throws GridBrokerException
Gets the job stats into counters in memory

Throws:
GridBrokerException

run

public final void run()
The run method enables the scheduler to run as a seperate thread, and calls the 'schedule()' method.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

isFailed

public boolean isFailed()
Returns:
Returns the failed.

setFailed

protected void setFailed()
                  throws GridBrokerException
Throws:
GridBrokerException

isClassValid

protected boolean isClassValid()
Returns if the current class is a valid one. This is used to avoid class loader problems with Tomcat.

Returns:
boolean

schedule

protected abstract void schedule()
                          throws java.lang.Exception
Abstract method: schedule to be implemented by derived classes which implement various scheduling algorithms.

Throws:
java.lang.Exception

isFinished

public boolean isFinished()
Returns whether the scheduling is finished.

Returns:
boolean

setFinished

protected void setFinished()
Sets the 'finished' state of the scheduler.


getPollTime

public long getPollTime()
Returns:
Returns the pollTime.

isFeasible

public boolean isFeasible()
Returns:
Returns the feasible.

setFeasible

protected void setFeasible(boolean feasible)
Parameters:
feasible - The feasible to set.

saveJobMapping

protected boolean saveJobMapping(Job job,
                                 ComputeServer server)
Maps the given job to the given server. All schedulers are expected to use this method as the only way to finalise the mapping and save it, so that the scheduleDispatcher can find it, and dispatch the job as needed.


saveJobMapping

protected boolean saveJobMapping(org.gridbus.scs.common.SCSJob job,
                                 ComputeServer server)

isSCSJobRequirementMet

protected boolean isSCSJobRequirementMet(org.gridbus.scs.common.SCSJob job,
                                         ComputeServer server)

freeQueueSlot

protected void freeQueueSlot(Job job)

isJobRequirementMet

protected boolean isJobRequirementMet(Job job,
                                      ComputeServer server)

getCandidateSCSServers

protected java.util.List getCandidateSCSServers(org.gridbus.scs.common.SCSJob job)
                                         throws GridBrokerException
Throws:
GridBrokerException

getCandidateServers

protected java.util.List getCandidateServers(Job job)
                                      throws GridBrokerException
Throws:
GridBrokerException

getNextReadySCSJob

protected org.gridbus.scs.common.SCSJob getNextReadySCSJob()
                                                    throws GridBrokerException
Throws:
GridBrokerException

getNextReadyJob

protected Job getNextReadyJob()
                       throws GridBrokerException
Throws:
GridBrokerException

jobReset

public void jobReset(Job job)
Description copied from interface: JobListener
Job is reset

Specified by:
jobReset in interface JobListener

statusChanged

public void statusChanged(Job job)
Description copied from interface: JobListener
Status changed event for a Job

Specified by:
statusChanged in interface JobListener
See Also:
JobListener.statusChanged(org.gridbus.broker.common.Job)

statusChanged

public void statusChanged(org.gridbus.scs.common.SCSJob job)
Description copied from interface: JobListener
SCS Job : Tom

Specified by:
statusChanged in interface JobListener
See Also:
JobListener.statusChanged(org.gridbus.scs.common.SCSJob)

saveStatusEvent

protected void saveStatusEvent(org.gridbus.scs.common.SCSJob job)
                        throws GridBrokerException
Throws:
GridBrokerException

saveStatusEvent

protected void saveStatusEvent(Job job)
                        throws GridBrokerException
Throws:
GridBrokerException

updateServerPerformance

protected void updateServerPerformance(Job job)
                                throws GridBrokerException
Throws:
GridBrokerException

updateStats

protected void updateStats()

updateQos

protected void updateQos(Qos qos,
                         float budgetspent,
                         long timespent)
Wrapper method for derived scheduler to update the qos

Parameters:
qos -
budgetspent -
timespent -

getReadyServers

protected java.util.List getReadyServers()
                                  throws GridBrokerException
Returns:
Throws:
GridBrokerException

updateJobStatus

protected void updateJobStatus(Job job,
                               int status)
                        throws GridBrokerException
Throws:
GridBrokerException

Copyright © The University of Melbourne. 2006