def enableInternalServices(): """ activates the internal services previously disabled due to expired credentials """ global servicesEnabled if servicesEnabled: log.error("Cannot (re)enable services, they're already running") from Ganga.Core.exceptions import GangaException raise GangaException("Cannot (re)enable services") # startup the registries from Ganga.Runtime import Repository_runtime Repository_runtime.bootstrap() # make sure all required credentials are valid invalid_afs = [afsToken for afsToken in credential_store.get_all_matching_type(AfsToken) if not afsToken.is_valid()] if invalid_afs: log.error('No valid AFS token was found. Please re-authorise before reactivating this session.') return log.debug("Enabling the internal services") # re-enable the monitoring loop as it's been explicityly requested here enableMonitoringService() servicesEnabled = True log.info('Internal services reactivated successfuly')
def enableInternalServices(): """ activates the internal services previously disabled due to expired credentials """ global servicesEnabled if servicesEnabled: log.error("Cannot (re)enable services, they're already running") from Ganga.Core.exceptions import GangaException raise GangaException("Cannot (re)enable services") # startup the registries from Ganga.Runtime import Repository_runtime Repository_runtime.bootstrap() # make sure all required credentials are valid invalid_afs = [ afsToken for afsToken in credential_store.get_all_matching_type(AfsToken) if not afsToken.is_valid() ] if invalid_afs: log.error( 'No valid AFS token was found. Please re-authorise before reactivating this session.' ) return log.debug("Enabling the internal services") # re-enable the monitoring loop as it's been explicityly requested here enableMonitoringService() servicesEnabled = True log.info('Internal services reactivated successfuly')
def __init__(self, registry_slice): GangaThread.__init__(self, name="JobRegistry_Monitor") log.debug("Constructing JobRegistry_Monitor") self.setDaemon(True) self.registry_slice = registry_slice self.__sleepCounter = 0.0 self.__updateTimeStamp = time.time() self.progressCallback = lambda x: None self.callbackHookDict = {} self.clientCallbackDict = {} self.alive = True self.enabled = False # run the monitoring loop continuosly (steps=-1) or just a specified # number of steps(>0) self.steps = -1 self.activeBackends = {} self.updateJobStatus = None self.errors = {} self.updateDict_ts = SynchronisedObject(UpdateDict()) # Create the default backend update method and add to callback hook. self.makeUpdateJobStatusFunction() # Add credential checking to monitoring loop for afsToken in credential_store.get_all_matching_type(AfsToken()): log.debug("Setting callback hook for %s" % afsToken.location) self.setCallbackHook(self.makeCredCheckJobInsertor(afsToken), {}, True, timeout=config['creds_poll_rate']) # Add low disk-space checking to monitoring loop log.debug("Setting callback hook for disk space checking") self.setCallbackHook(self.diskSpaceCheckJobInsertor, {}, True, timeout=config['diskspace_poll_rate']) # synch objects # main loop mutex self.__mainLoopCond = threading.Condition() # cleanup synch self.__cleanUpEvent = threading.Event() # asynch mon loop running synch self.__monStepsTerminatedEvent = threading.Event() # event to signal the break of job lists iterators self.stopIter = threading.Event() self.stopIter.set() self._runningNow = False