55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
|
|
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
|
|
|
|
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
|
|
self.m_numUsedSlots = None
|
|
self.m_fCpuLoad = None
|
|
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
|
|
def setNumUsedSlots( self, numSlots ):
|
|
self.m_numUsedSlots = numSlots
|
|
def getNumSlots( self ):
|
|
assert( self.m_numSlots != None )
|
|
return self.m_numSlots
|
|
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
|
|
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
|
|
""" |