correction de fautes de typo et ajout d'une variable en prévision d'un mécanisme d'arrêt du daemon

This commit is contained in:
Guillaume Raffy 2012-07-03 14:24:41 +00:00
parent a1ace896b9
commit 224afd6591
1 changed files with 6 additions and 4 deletions

View File

@ -43,7 +43,7 @@ class SleepCompleteNotifier( ISleepCompleteNotifier ):
self.m_machineName = machineName self.m_machineName = machineName
self.m_clusterController = clusterController self.m_clusterController = clusterController
def onSleepComplete( self, bSleepSucceeded ): def onSleepComplete( self, bSleepSucceeded ):
logDebug('WakeUpCompleteNotifier::onWakeUpComplete : start') logDebug('SleepCompleteNotifier::onSleepComplete : start')
self.m_clusterController.onMachineSleepComplete( self.m_machineName, bSleepSucceeded ) self.m_clusterController.onMachineSleepComplete( self.m_machineName, bSleepSucceeded )
def jouleToKwh( fEnergyInJoules ): def jouleToKwh( fEnergyInJoules ):
@ -79,6 +79,8 @@ class ClusterController:
self.DELAY_BETWEEN_ENERGY_STATUS_LOGS = 60 # in seconds self.DELAY_BETWEEN_ENERGY_STATUS_LOGS = 60 # in seconds
self.m_iSessionId = None # session (run) identifier in database self.m_iSessionId = None # session (run) identifier in database
self.m_webServer = WebServerThread(self) self.m_webServer = WebServerThread(self)
self.m_bStop = False
self.m_bStopLock = threading.Lock() # to prevent concurrent access to m_bStop
def getClusterStatus( self ): def getClusterStatus( self ):
return self.m_clusterStatus return self.m_clusterStatus
@ -104,9 +106,9 @@ class ClusterController:
#logDebug('ClusterController::onMachineSleepComplete : machine %s new len(self.m_machinesThatNeedWakeUp) = %d' % (machineName,len(self.m_machinesThatNeedWakeUp)) ) #logDebug('ClusterController::onMachineSleepComplete : machine %s new len(self.m_machinesThatNeedWakeUp) = %d' % (machineName,len(self.m_machinesThatNeedWakeUp)) )
self.m_machinesThatNeedSleepingLock.release() self.m_machinesThatNeedSleepingLock.release()
if bSleepSucceeded: if bSleepSucceeded:
logDebug('ClusterController::onMachineWakeUpComplete : removed %s from the list of machines that need waking up because it\'s now awake' % machineName) logDebug('ClusterController::onMachineSleepComplete : removed %s from the list of machines that need sleeping because it\'s now sleeping' % machineName)
else: else:
logDebug('ClusterController::onMachineWakeUpComplete : removed %s from the list of machines that need waking up because it can\'t be put to sleep at the moment (eg a job just arrived)' % machineName) logDebug('ClusterController::onMachineSleepComplete : removed %s from the list of machines that need sleeping because it can\'t be put to sleep at the moment (eg a job just arrived)' % machineName)
def getNumPendingWakeUps( self ): def getNumPendingWakeUps( self ):
self.m_machinesThatNeedWakeupLock.acquire() self.m_machinesThatNeedWakeupLock.acquire()
@ -243,7 +245,7 @@ class ClusterController:
None None
logInfo('ClusterController::run : cluster initial readings have completed') logInfo('ClusterController::run : cluster initial readings have completed')
startTime = time.localtime() startTime = time.localtime()
while True: while not self.m_bStop:
currentTime = time.time() currentTime = time.time()
#clusterStatus.m_nodesStatus['simpatix10'].dump() #clusterStatus.m_nodesStatus['simpatix10'].dump()
if (not self.m_lastEnergyStatusLogTime) or (currentTime > (self.m_lastEnergyStatusLogTime +self.DELAY_BETWEEN_ENERGY_STATUS_LOGS)): if (not self.m_lastEnergyStatusLogTime) or (currentTime > (self.m_lastEnergyStatusLogTime +self.DELAY_BETWEEN_ENERGY_STATUS_LOGS)):