org.gridbus.broker.farming.common
Class ComputeServer

java.lang.Object
  extended by org.gridbus.broker.farming.common.Server
      extended by org.gridbus.broker.farming.common.ComputeServer
Direct Known Subclasses:
AlchemiComputeServer, CondorComputeServer, ForkComputeServer, GlobusComputeServer, PBSComputeServer, SGEComputeServer, UnicoreComputeServer, XgridComputeServer

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 (v.0.8)
static int ALCHEMI_0_8
           
static int BUSY
          Server is busy
static int CHECKING_REQUIREMENTS
          Status used when the ComputeServer is checking requirements...
static int CONDOR
          Default Condor Version supported (v.6.6.9)
static int CONDOR_6_6_9
           
static int CONDOR_SHAREDFS
          Condor server with a shared-file-system
static int FORK
           
static int GLOBUS
          Default Globus version supported (v.2.4)
static int GLOBUS_2_4
           
static int GLOBUS_3_2
           
static int GLOBUS_4_0
           
static int NORDUGRID
          Default NORDUGRID version supported ()
static int PBS
          Default PBS version supported (OpenPBS 2.3)
static int READY
          Server is ready
static int SGE
          Default SGE version supported ()
static int STATUS_ANY
          Refers to ComputeServer with all / any status
static int UNICORE
          Default Unicore version supported (v.4.1)
static int UNICORE_4_1
           
static int UNKNOWN
           
static int XGRID
          Default XGRID version supported (technical preview 2, v.1.0)
 
Constructor Summary
ComputeServer(java.lang.String hostname, java.lang.String managerType, java.lang.Object o)
          This constructor allows for passing of an Object which may be used to configure this object.
ComputeServer(java.lang.String hostname, java.lang.String managerType, java.lang.Object o, Dispatcher d)
          Constructor using the dispatcher
 
Method Summary
 void addJobListener(JobListener jl)
          Registers a joblistener with the server.
 void addQueue(JobQueue q)
           
 void calcJobLimit(long totalWaitJobs, float totalAvgRateCompl)
          Calculates the number of jobs that can be allocated to this server.
 void decAllocatedJobs()
          Decrements the number of jobs allocated to this server
abstract  boolean discoverProperties()
          Discover the dynamic server properties
 boolean discoverPropertiesGeneric()
          Checks if the compute server is up, and sets all its attributes (This method has some generic code that could be used by all middleware(running locally / remotely-on-Unix-like nodes))
 long 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
 long getBufferedJobs()
          Returns the number of jobs locally queued to this server and not in execution
 float getBusytime()
          Returns the time interval for which the server was busy.
 java.lang.Object getConfig()
           
 java.lang.String getContactString()
          Returns the server contact string.
 java.lang.String getCPU()
          Returns the processor in the compute server
 java.lang.String getCPUspeed()
          Returns the processor speed.
 Dispatcher getDispatcher()
          tcma added for the dispatcher
 long getExecutingJobs()
          Returns the number of jobs currently executing on the server.
 long getFailedJobs()
          Returns the number of failed jobs
 int getJobLimit()
          Returns the maximum number of jobs that can be allocated to this server.
 java.lang.String getJobManager()
           
 int getJobsCompletedCurrentPoll()
          Returns the number of jobs finished since the last time the server information was updated
 int getMaxnumjobs()
           
 float getMemfree()
          Returns the free RAM available
 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 getQueues()
           
 int getServerStatus()
          Returns the server status as an integer
 java.lang.String getStatus()
          returns the Status of this compute Server
 float getTimeperjob()
          Returns the time taken per job
 long 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 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 isFirewalled()
           
 boolean isRequirementSatisfied()
           
 void notifyListeners(Job j)
           
 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.
static java.lang.String serverTypeString(int serverType)
          Default type is GLOBUS.
 void setAliveFlag(boolean alive)
          Sets the alive flag
 void setAllocatedJobs(long 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 setBufferedJobs(long locallyQed)
           
 void setBusytime(float busytime)
          Sets the busytime.
 void setConfig(java.lang.Object o)
          The object o, is used to set some configuration properties for the ComputeServer, and related classes.
 void setContactString(java.lang.String string)
          Sets the server contact string.
 void setDispatcher(Dispatcher d)
          Sets the dispatcher
 void setExecutingJobs(long executingJobs)
           
 void setFailedJobs(long failedJobs)
           
 void setFirewalled(boolean isFirewalled)
           
 void setJobLimit(int jobLimit)
          Sets the maximum number of jobs that can be allocated to this server.
 void setJobManager(java.lang.String jobManager)
           
 void setJobsCompletedCurrentPoll(int n)
          Sets the number of Finished jobs
 void setMaxnumjobs(int maxnumjobs)
           
 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 setQueues(java.util.Collection queues)
           
 void setTimeperjob(float timeperjob)
          Sets the timeperjob.
 void setTotalFinishedJobs(long 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.
static int statusInt(java.lang.String serverStatus)
          Converts the given string status to int form.
static java.lang.String statusString(int serverStatus)
          Converts the given int status to string form.
 void submitJob(Job j)
          Submits a job for execution on this server.
 void updateAvgRateofCompletion(int numPoll, int pollTime)
          Updates the average rate of completion
 void updateStatus(java.lang.String status)
          Updates the status of this server.
 
Methods inherited from class org.gridbus.broker.farming.common.Server
getHostname, getServerID, setHostname, setServerID
 
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

public static final int FORK
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 (v.2.4)

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 (v.4.1)

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 (v.0.8)

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 (v.6.6.9)

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 (OpenPBS 2.3)

See Also:
Constant Field Values

NORDUGRID

public static final int NORDUGRID
Default NORDUGRID version supported ()

See Also:
Constant Field Values

XGRID

public static final int XGRID
Default XGRID version supported (technical preview 2, v.1.0)

See Also:
Constant Field Values

SGE

public static final int SGE
Default SGE version supported ()

See Also:
Constant Field Values

READY

public static final int READY
Server is ready

See Also:
Constant Field Values

BUSY

public static final int BUSY
Server is busy

See Also:
Constant Field Values

CHECKING_REQUIREMENTS

public static final int CHECKING_REQUIREMENTS
Status used when the ComputeServer is checking requirements...

See Also:
Constant Field Values

STATUS_ANY

public static final int STATUS_ANY
Refers to ComputeServer with all / any status

See Also:
Constant Field Values
Constructor Detail

ComputeServer

public ComputeServer(java.lang.String hostname,
                     java.lang.String managerType,
                     java.lang.Object o)
This constructor allows for passing of an Object which may be used to configure this object. Every subclass should call this constructor using super(Object) to ensure the properties are initialised properly. In the current implementation Object parameter is an instance of the BrokerProperties class.

Parameters:
hostname -
managerType -
o -

ComputeServer

public ComputeServer(java.lang.String hostname,
                     java.lang.String managerType,
                     java.lang.Object o,
                     Dispatcher d)
Constructor using the dispatcher

Parameters:
hostname -
managerType -
o -
d -
Method Detail

setConfig

public void setConfig(java.lang.Object o)
The object o, is used to set some configuration properties for the ComputeServer, and related classes. These properties include, the local and remote working directories. In the current implementation Object parameter is an instance of the BrokerProperties class.

Parameters:
o -

statusString

public static java.lang.String statusString(int serverStatus)
Converts the given int status to string form. Available status-es are "ready" (0) and "busy" (1).

Parameters:
serverStatus -
Returns:

statusInt

public static int statusInt(java.lang.String serverStatus)
Converts the given string status to int form. Available status-es are "ready" (0) and "busy" (1).

Parameters:
serverStatus -
Returns:

serverTypeString

public static java.lang.String serverTypeString(int serverType)
Default type is GLOBUS.

Parameters:
serverType -
Returns:

getStatus

public java.lang.String getStatus()
returns the Status of this compute Server

Returns:
status string

getServerStatus

public int getServerStatus()
Returns the server status as an integer

Returns:

getMaxnumjobs

public int getMaxnumjobs()
Returns:
Returns the maximum number of jobs that can be given to this server under any circumstance. This should be user-settable through xgrl

setMaxnumjobs

public void setMaxnumjobs(int maxnumjobs)
Parameters:
maxnumjobs - The maxnumjobs to set.

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 long getAllocatedJobs()
Returns the number of jobs allocated to this server and not in execution

Returns:
# of jobs allocated to this server

getBufferedJobs

public long getBufferedJobs()
Returns the number of jobs locally queued to this server and not in execution

Returns:
# of jobs buffered 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 long 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 long 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


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


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(long number)
Sets the number of jobs that have been allocated to this server.

Parameters:
number -

setExecutingJobs

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

setFailedJobs

public void setFailedJobs(long 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

setTotalFinishedJobs

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

Parameters:
i -

discoverPropertiesGeneric

public boolean discoverPropertiesGeneric()
Checks if the compute server is up, and sets all its attributes (This method has some generic code that could be used by all middleware(running locally / remotely-on-Unix-like nodes))

Returns:
true if the properties have been discovered

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

updateStatus

public void updateStatus(java.lang.String status)
Updates the status of this server.

Parameters:
status -

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 long 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 -

notifyListeners

public final void notifyListeners(Job j)
Parameters:
j -

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.

getQueues

public java.util.Collection getQueues()
Returns:
Returns the queues.

addQueue

public void addQueue(JobQueue q)
Parameters:
q -

setQueues

public void setQueues(java.util.Collection queues)
Parameters:
queues - The queues to set.

getConfig

public java.lang.Object getConfig()
Returns:
configuration properties for the server

isFirewalled

public boolean isFirewalled()
Returns:
Returns the isFirewalled.

setFirewalled

public void setFirewalled(boolean isFirewalled)
Parameters:
isFirewalled - The isFirewalled to set.

setDispatcher

public void setDispatcher(Dispatcher d)
Sets the dispatcher

Parameters:
d -

getDispatcher

public Dispatcher getDispatcher()
tcma added for the dispatcher

Returns:

getJobManager

public java.lang.String getJobManager()
Returns:
Returns the jobManager.

setJobManager

public void setJobManager(java.lang.String jobManager)
Parameters:
jobManager - The jobManager to set.

setBufferedJobs

public void setBufferedJobs(long locallyQed)
Parameters:
locallyQed -

getCPU

public java.lang.String getCPU()
Returns the processor in the compute server

Returns:
string

getMemfree

public float getMemfree()
Returns the free RAM available

Returns:
float

getCPUspeed

public java.lang.String getCPUspeed()
Returns the processor speed.

Returns:
string