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
|
2013-04-19 11:00:01 +02:00
|
|
|
OBSOLETE=16 # the queue no longer exists but it is still visible because it still contains running jobs
|
2016-05-03 14:19:24 +02:00
|
|
|
SUSPENDED=32 # the queue machine is suspended
|
2012-05-29 18:31:01 +02:00
|
|
|
|
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
|
2016-05-03 14:19:24 +02:00
|
|
|
def isResponding( self ):
|
|
|
|
return not (self.m_stateFlags & QueueMachineStateFlags.UNKNOWN)
|
|
|
|
def isInAlarmState( self ):
|
|
|
|
return self.m_stateFlags & QueueMachineStateFlags.ALARM
|
|
|
|
def isSuspended( self ):
|
|
|
|
return self.m_stateFlags & QueueMachineStateFlags.SUSPENDED
|
2012-05-29 18:31:01 +02:00
|
|
|
"""
|
|
|
|
def getStateAsString( self ):
|
|
|
|
assert( self.m_strState != None )
|
|
|
|
return self.m_strState
|
|
|
|
"""
|