2011-10-07 17:43:45 +02:00
|
|
|
|
2012-05-29 18:31:01 +02:00
|
|
|
class QueueMachineStateFlags: #
|
|
|
|
DISABLED=1 # the queue machine is disabled
|
|
|
|
ALARM=2 # the queue machine is in alarm state (see man qstat)
|
|
|
|
UNKNOWN=4 # the queue machine is in unknown state because sge_execd cannot be contected (see man qstat)
|
|
|
|
ERROR=8 # the queue is in error state
|
|
|
|
|
2011-10-07 17:43:45 +02:00
|
|
|
class QueueMachine:
|
|
|
|
"""
|
|
|
|
a QueueMachine instance represents a given SGE queue on a given machine (eg allintel.q@simpatix10)
|
|
|
|
"""
|
|
|
|
def __init__( self, queueName, machineName ):
|
|
|
|
self.m_queueName = queueName
|
|
|
|
self.m_machineName = machineName
|
|
|
|
self.m_numSlots = None
|
2012-05-29 16:05:18 +02:00
|
|
|
self.m_numUsedSlots = None
|
|
|
|
self.m_fCpuLoad = None
|
2011-10-07 17:43:45 +02:00
|
|
|
def getName( self ):
|
|
|
|
"""
|
|
|
|
returns the name of the machine queue (such as allintel.q@simpatix10)
|
|
|
|
"""
|
|
|
|
return self.m_queueName + '@' + self.m_machineName
|
|
|
|
|
|
|
|
def getQueueName( self ):
|
|
|
|
return self.m_queueName
|
|
|
|
def getMachineName( self ):
|
|
|
|
return self.m_machineName
|
|
|
|
def setNumSlots( self, numSlots ):
|
|
|
|
self.m_numSlots = numSlots
|
2012-05-29 16:05:18 +02:00
|
|
|
def setNumUsedSlots( self, numSlots ):
|
|
|
|
self.m_numUsedSlots = numSlots
|
2011-10-07 17:43:45 +02:00
|
|
|
def getNumSlots( self ):
|
|
|
|
assert( self.m_numSlots != None )
|
|
|
|
return self.m_numSlots
|
2012-05-29 16:05:18 +02:00
|
|
|
def getNumUsedSlots( self ):
|
|
|
|
assert( self.m_numUsedSlots != None )
|
|
|
|
return self.m_numUsedSlots
|
|
|
|
def setCpuLoad( self, fCpuLoad ):
|
|
|
|
self.m_fCpuLoad = fCpuLoad
|
|
|
|
def cpuLoadIsAvailable( self ):
|
|
|
|
return self.m_fCpuLoad != None
|
|
|
|
def getCpuLoad( self ):
|
|
|
|
assert( self.m_fCpuLoad != None )
|
|
|
|
return self.m_fCpuLoad
|
2012-05-29 18:31:01 +02:00
|
|
|
def setState( self, state ):
|
|
|
|
self.m_stateFlags = state
|
|
|
|
def isDisabled( self ):
|
|
|
|
return self.m_stateFlags & QueueMachineStateFlags.DISABLED
|
|
|
|
def isInErrorState( self ):
|
|
|
|
return self.m_stateFlags & QueueMachineStateFlags.ERROR
|
|
|
|
"""
|
|
|
|
def getStateAsString( self ):
|
|
|
|
assert( self.m_strState != None )
|
|
|
|
return self.m_strState
|
|
|
|
"""
|