org.gridbus.broker.farming.common
Class ComputeServer

java.lang.Object
  |
  +--org.gridbus.broker.farming.common.Server
        |
        +--org.gridbus.broker.farming.common.ComputeServer
Direct Known Subclasses:
AlchemiComputeServer, CondorComputeServer, ForkComputeServer, GlobusComputeServer, PBSComputeServer, UnicoreComputeServer

public abstract class ComputeServer
extends Server

This class describes a general computational server and provides the methods for accessing and manipulating the information contained.

Author:
Srikumar Venugopal(srikumar@cs.mu.oz.au)

Field Summary
static int ALCHEMI
          Default Alchemi version supported
static int ALCHEMI_0_8
           
static int CONDOR
          Default Condor Version supported
static int CONDOR_6_6_9
           
static int CONDOR_SHAREDFS
          Condor server with a shared-file-system
static int FORK_LOCAL
           
static int GLOBUS
          Default Globus version supported
static int GLOBUS_2_4
           
static int GLOBUS_3_2
           
static int GLOBUS_4_0
           
static int NORDUGRID
           
static int PBS
          Default PBS version supported
static int UNICORE
          Default Unicore version supported
static int UNICORE_4_1
           
static int UNKNOWN
           
static int XGRID
           
 
Fields inherited from class org.gridbus.broker.farming.common.Server
BUSY, READY
 
Constructor Summary
ComputeServer()
           
 
Method Summary
 void addJobListener(JobListener jl)
          Registers a joblistener with the server.
 void calcJobLimit(long totalWaitJobs, float totalAvgRateCompl)
          Calculates the number of jobs that can be allocated to this server.
 boolean checkRequirements()
          Sends off a job to check if the requirements are satisfied, and tries to perform the appropriate operations to satisfy the requirement.
 void decAllocatedJobs()
          Decrements the number of jobs allocated to this server
 void decExecutingJobs()
          Deprecated.  
abstract  boolean discoverProperties()
          Discover the dynamic server properties
 int getAllocatedJobs()
          Returns the number of jobs allocated to this server and not in execution
 java.lang.String getArch()
          Returns the architecture of the compute server
 float getAvgJobComputationTime()
          Returns the average job completion time
 float getAvgRateofCompletion()
          Returns the rate of completion of jobs of this server averaged over the number of polling intervals
 float getBusytime()
          Returns the time interval for which the server was busy.
 java.lang.String getContactString()
          Returns the server contact string.
 int getExecutingJobs()
          Returns the number of jobs currently executing on the server.
 int getFailedJobs()
          Returns the number of failed jobs
 int getJobLimit()
          Returns the maximum number of jobs that can be allocated to this server.
 int getJobsCompletedCurrentPoll()
          Returns the number of jobs finished since the last time the server information was updated
 float getMemtotal()
          Returns total physical memory (RAM) available
 NodeRequirement getNodeRequirements()
           
 int getNumCPUs()
          Returns the number of processors.
 java.lang.String getOS()
          Returns the OS string
 float getPrevtime()
          Returns the prevtime.
 float getPricePerCpuSec()
          Returns the cost of using the server per one second of CPU execution time
 float getPricePerJob()
          Returns the cost per each job executed on this computeserver
 java.util.Collection getQueueCollection()
           
 float getTimeperjob()
          Returns the time taken per job
 int getTotalFinishedJobs()
          Returns the number of jobs that have been finished on this server so far.
 int getType()
           
 UserCredential getUserCredential()
           
 void incAllocatedJobs()
          Increments the number of jobs allocated to this server
 void incExecutingJobs()
          Deprecated.  
 void incFailedJobs()
          Increments the number of jobs failed on this server
 void incJobsCompletedCurrentPoll()
          Increments the number of jobs that have finished on this server
 void incTotalFinishedJobs()
          Increments the totalFinishedJobs.
 boolean isAlive()
          Checks if this server is alive or not, that is whether it is reachable and responding to queries.
 boolean isRequirementSatisfied()
           
 void recoverJob(Job j)
          This method queries the remote-node for the latest job-status and tries to recover the job output from the remote-node.
 void removeAllJobListeners()
          Unregisters all the joblisteners
 void removeJobListener(JobListener jl)
          Unregisters a joblistener.
 void setAliveFlag(boolean alive)
          Sets the alive flag
 void setAllocatedJobs(int number)
          Sets the number of jobs that have been allocated to this server.
 void setArch(java.lang.String string)
          Sets the architecture of this server
 void setAvgJobComputationTime(float f)
          Sets the average job completion time
 void setBusytime(float busytime)
          Sets the busytime.
 void setContactString(java.lang.String string)
          Sets the server contact string.
 void setExecutingJobs(int executingJobs)
           
 void setFailedJobs(int failedJobs)
           
 void setJobLimit(int jobLimit)
          Sets the maximum number of jobs that can be allocated to this server.
 void setJobsCompletedCurrentPoll(int n)
          Sets the number of Finished jobs
 void setManager(ComputeServerManager manager)
           
 void setMemtotal(float f)
          Sets the value for the total physical memory for this server
 void setNodeRequirements(NodeRequirement nodeRequirements)
           
 void setNumCPUs(int i)
          Sets the number of processors.
 void setOS(java.lang.String string)
          Sets the OS
 void setPrevtime(float prevtime)
          Sets the last time the server information was updated
 void setPricePerCpuSec(float cost)
          Sets the cost of using the server per second of the CPUtime used
 void setPricePerJob(float cost)
          Sets the cost per job for this compute server
 void setQueueCollection(java.util.Collection queueCollection)
           
 void setServerID(java.lang.String string)
          Sets the server ID
 void setTimeperjob(float timeperjob)
          Sets the timeperjob.
 void setTotalFinishedJobs(int i)
          Sets the number of jobs that have been finished so far
 void setType(int type)
           
 void setUserCredential(UserCredential userCredential)
           
 void shutdown()
          This method will stop the manager for this compute server, and shutdown the compute server.
 void startMonitoring(Job j)
          Starts monitoring the job passed in, if it was submitted to this server.
 void startup()
          Start the ComputeServer, and its Manager and JobMonitor for this server.
 void submitJob(Job j)
          Submits a job for execution on this server.
 void updateAvgRateofCompletion(int numPoll, int pollTime)
          Updates the average rate of completion
abstract  void updateStatus()
          Updates the status of this server.
 
Methods inherited from class org.gridbus.broker.farming.common.Server
getHostname, getServerID, getServerStatus, getStatus, setHostname, setServerStatus, setStatus, statusInt, statusString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

FORK_LOCAL

public static final int FORK_LOCAL
See Also:
Constant Field Values

GLOBUS_2_4

public static final int GLOBUS_2_4
See Also:
Constant Field Values

GLOBUS_3_2

public static final int GLOBUS_3_2
See Also:
Constant Field Values

GLOBUS_4_0

public static final int GLOBUS_4_0
See Also:
Constant Field Values

GLOBUS

public static final int GLOBUS
Default Globus version supported

See Also:
Constant Field Values

UNICORE_4_1

public static final int UNICORE_4_1
See Also:
Constant Field Values

UNICORE

public static final int UNICORE
Default Unicore version supported

See Also:
Constant Field Values

ALCHEMI_0_8

public static final int ALCHEMI_0_8
See Also:
Constant Field Values

ALCHEMI

public static final int ALCHEMI
Default Alchemi version supported

See Also:
Constant Field Values

CONDOR_6_6_9

public static final int CONDOR_6_6_9
See Also:
Constant Field Values

CONDOR

public static final int CONDOR
Default Condor Version supported

See Also:
Constant Field Values

CONDOR_SHAREDFS

public static final int CONDOR_SHAREDFS
Condor server with a shared-file-system

See Also:
Constant Field Values

PBS

public static final int PBS
Default PBS version supported

See Also:
Constant Field Values

NORDUGRID

public static final int NORDUGRID
See Also:
Constant Field Values

XGRID

public static final int XGRID
See Also:
Constant Field Values
Constructor Detail

ComputeServer

public ComputeServer()
Method Detail

setManager

public void setManager(ComputeServerManager manager)
Parameters:
manager -

startup

public final void startup()
Start the ComputeServer, and its Manager and JobMonitor for this server. This will also discover if the compute server is alive, by pinging it.


shutdown

public final void shutdown()
This method will stop the manager for this compute server, and shutdown the compute server.


calcJobLimit

public void calcJobLimit(long totalWaitJobs,
                         float totalAvgRateCompl)
Calculates the number of jobs that can be allocated to this server. Based on performance criteria such as its rate of completion in comparison to the total rate of completion.

Parameters:
totalWaitJobs -
totalAvgRateCompl -

getAllocatedJobs

public int getAllocatedJobs()
Returns the number of jobs allocated to this server and not in execution

Returns:
# of jobs allocated to this server

getAvgRateofCompletion

public float getAvgRateofCompletion()
Returns the rate of completion of jobs of this server averaged over the number of polling intervals

Returns:
average job completion rate

getBusytime

public float getBusytime()
Returns the time interval for which the server was busy.

Returns:
time duration for which the server is busy

getPricePerCpuSec

public float getPricePerCpuSec()
Returns the cost of using the server per one second of CPU execution time

Returns:
pricePerCpuSecond

getPricePerJob

public float getPricePerJob()
Returns the cost per each job executed on this computeserver

Returns:
cost per job

getExecutingJobs

public int getExecutingJobs()
Returns the number of jobs currently executing on the server.

Returns:
# of executing jobs

getJobsCompletedCurrentPoll

public int getJobsCompletedCurrentPoll()
Returns the number of jobs finished since the last time the server information was updated

Returns:
# of jobs completed since last poll

getJobLimit

public int getJobLimit()
Returns the maximum number of jobs that can be allocated to this server. This limit comes from @see #calcJobLimit

Returns:
job limit

getPrevtime

public float getPrevtime()
Returns the prevtime.

Returns:
previous time

getTimeperjob

public float getTimeperjob()
Returns the time taken per job

Returns:
time per job

getTotalFinishedJobs

public int getTotalFinishedJobs()
Returns the number of jobs that have been finished on this server so far.

Returns:
# of finished jobs

incAllocatedJobs

public void incAllocatedJobs()
Increments the number of jobs allocated to this server


decAllocatedJobs

public void decAllocatedJobs()
Decrements the number of jobs allocated to this server


incExecutingJobs

public void incExecutingJobs()
Deprecated.  

Increments the number of jobs executing on this server


incJobsCompletedCurrentPoll

public void incJobsCompletedCurrentPoll()
Increments the number of jobs that have finished on this server


incTotalFinishedJobs

public void incTotalFinishedJobs()
Increments the totalFinishedJobs.


incFailedJobs

public void incFailedJobs()
Increments the number of jobs failed on this server


checkRequirements

public final boolean checkRequirements()
Sends off a job to check if the requirements are satisfied, and tries to perform the appropriate operations to satisfy the requirement. If successful, it sets the isRequirementSatisfied flag to true.

Returns:
true if the requirements are satisfied

isAlive

public boolean isAlive()
Checks if this server is alive or not, that is whether it is reachable and responding to queries. This is not to be confused with the Server.getStatus / setStatus methods, which do-not really specify whether a server is alive (ping-able) or not.

Returns:
true if this server is alive, false otherwise

setAliveFlag

public void setAliveFlag(boolean alive)
Sets the alive flag

Parameters:
alive -

setAllocatedJobs

public void setAllocatedJobs(int number)
Sets the number of jobs that have been allocated to this server.

Parameters:
number -

setExecutingJobs

public void setExecutingJobs(int executingJobs)
Parameters:
executingJobs - The executingJobs to set.

setFailedJobs

public void setFailedJobs(int failedJobs)
Parameters:
failedJobs - The failedJobs to set.

updateAvgRateofCompletion

public void updateAvgRateofCompletion(int numPoll,
                                      int pollTime)
Updates the average rate of completion

Parameters:
numPoll -
pollTime -

setBusytime

public void setBusytime(float busytime)
Sets the busytime.

Parameters:
busytime - The busytime to set

setPricePerCpuSec

public void setPricePerCpuSec(float cost)
Sets the cost of using the server per second of the CPUtime used

Parameters:
cost -

setPricePerJob

public void setPricePerJob(float cost)
Sets the cost per job for this compute server

Parameters:
cost -

setJobsCompletedCurrentPoll

public void setJobsCompletedCurrentPoll(int n)
Sets the number of Finished jobs

Parameters:
n -

setJobLimit

public void setJobLimit(int jobLimit)
Sets the maximum number of jobs that can be allocated to this server.

Parameters:
jobLimit - The jobLimit to set

setPrevtime

public void setPrevtime(float prevtime)
Sets the last time the server information was updated

Parameters:
prevtime - The prevtime to set

setTimeperjob

public void setTimeperjob(float timeperjob)
Sets the timeperjob.

Parameters:
timeperjob - The timeperjob to set

setServerID

public void setServerID(java.lang.String string)
Sets the server ID

Parameters:
string -

setTotalFinishedJobs

public void setTotalFinishedJobs(int i)
Sets the number of jobs that have been finished so far

Parameters:
i -

discoverProperties

public abstract boolean discoverProperties()
                                    throws java.lang.Exception
Discover the dynamic server properties

Returns:
true, if the properties were discovered successfully.
Throws:
java.lang.Exception

decExecutingJobs

public void decExecutingJobs()
Deprecated.  

Decrements the number of jobs currently executing on this server


updateStatus

public abstract void updateStatus()
Updates the status of this server.


submitJob

public final void submitJob(Job j)
Submits a job for execution on this server.

Parameters:
j - - the Job to be executed.

startMonitoring

public final void startMonitoring(Job j)
Starts monitoring the job passed in, if it was submitted to this server.

Parameters:
j -

getOS

public java.lang.String getOS()
Returns the OS string

Returns:
OS

setOS

public void setOS(java.lang.String string)
Sets the OS

Parameters:
string -

getAvgJobComputationTime

public float getAvgJobComputationTime()
Returns the average job completion time

Returns:
Average Job Completion Time

setAvgJobComputationTime

public void setAvgJobComputationTime(float f)
Sets the average job completion time

Parameters:
f -

getFailedJobs

public int getFailedJobs()
Returns the number of failed jobs

Returns:
# of failed jobs

getContactString

public java.lang.String getContactString()
Returns the server contact string.

Returns:
string

setContactString

public void setContactString(java.lang.String string)
Sets the server contact string.

Parameters:
string -

getArch

public java.lang.String getArch()
Returns the architecture of the compute server

Returns:
string

getMemtotal

public float getMemtotal()
Returns total physical memory (RAM) available

Returns:
float

setArch

public void setArch(java.lang.String string)
Sets the architecture of this server

Parameters:
string -

setMemtotal

public void setMemtotal(float f)
Sets the value for the total physical memory for this server

Parameters:
f -

getNumCPUs

public int getNumCPUs()
Returns the number of processors.

Returns:
int

setNumCPUs

public void setNumCPUs(int i)
Sets the number of processors.

Parameters:
i - int

getType

public int getType()
Returns:
Returns the type.

setType

public void setType(int type)
Parameters:
type - The type to set.

setNodeRequirements

public void setNodeRequirements(NodeRequirement nodeRequirements)
Parameters:
nodeRequirements -

getNodeRequirements

public NodeRequirement getNodeRequirements()
Returns:
Returns the nodeRequirements.

isRequirementSatisfied

public boolean isRequirementSatisfied()
Returns:
Returns the isRequirementSatisfied.

addJobListener

public final void addJobListener(JobListener jl)
Registers a joblistener with the server. This joblistener will recieve job status updates from the server

Parameters:
jl -

removeJobListener

public final void removeJobListener(JobListener jl)
Unregisters a joblistener.

Parameters:
jl -

removeAllJobListeners

public final void removeAllJobListeners()
Unregisters all the joblisteners


recoverJob

public final void recoverJob(Job j)
This method queries the remote-node for the latest job-status and tries to recover the job output from the remote-node. Typically, this method is called by the recovery process for jobs that couldnot get the result back to the broker.

Parameters:
j - (Job whose output needs to be recovered).

getUserCredential

public UserCredential getUserCredential()
Returns:
Returns the userCredential.

setUserCredential

public void setUserCredential(UserCredential userCredential)
Parameters:
userCredential - The userCredential to set.

getQueueCollection

public java.util.Collection getQueueCollection()
Returns:
Returns the queueCollection.

setQueueCollection

public void setQueueCollection(java.util.Collection queueCollection)
Parameters:
queueCollection - The queueCollection to set.