def __init__(self, config): """ Initialise class members """ BaseDaemon.__init__(self, config, 'RetryManager') if self.config.isOracle: self.oracleDB = HTTPRequests(self.config.oracleDB, self.config.opsProxy, self.config.opsProxy) else: try: server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) except Exception as e: self.logger.exception('A problem occured when connecting to couchDB: %s' % e) raise self.logger.debug('Connected to files DB') # Set up a factory for loading plugins self.factory = WMFactory(self.config.retryAlgoDir, namespace=self.config.retryAlgoDir) try: self.plugin = self.factory.loadObject(self.config.algoName, self.config, getFromCache=False, listFlag=True) except Exception as ex: msg = "Error loading plugin %s on path %s\n" % (self.config.algoName, self.config.retryAlgoDir) msg += str(ex) self.logger.error(msg) raise RetryManagerException(msg) self.cooloffTime = self.config.cooloffTime
def __init__(self, config): """ Initialise class members """ #Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'AsyncTransfer') self.dropbox_dir = '%s/dropbox/outputs' % self.config.componentDir if not os.path.isdir(self.dropbox_dir): try: os.makedirs(self.dropbox_dir) except OSError as e: if e.errno == errno.EEXIST: pass else: self.logger.error('Unknown error in mkdir' % e.errno) raise server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) config_server = CouchServer(dburl=self.config.config_couch_instance) self.config_db = config_server.connectDatabase(self.config.config_database) self.logger.debug('Connected to CouchDB') self.pool = Pool(processes=self.config.pool_size) try: self.phedex = PhEDEx(responseType='xml', dict = {'key': self.config.opsProxy, 'cert': self.config.opsProxy}) except Exception as e: self.logger.exception('PhEDEx exception: %s' % e) # Set up a factory for loading plugins self.factory = WMFactory(self.config.schedAlgoDir, namespace = self.config.schedAlgoDir) result_list = [] current_running = []
def __init__(self, config): BaseDaemon.__init__(self, config, 'Analytics') server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) self.logger.debug('Connected to local couchDB') config_server = CouchServer(dburl=self.config.config_couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.config_db = config_server.connectDatabase(self.config.config_database) self.amq_auth_file = self.config.amq_auth_file monitoring_server = CouchServer(dburl=self.config.couch_user_monitoring_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.monitoring_db = monitoring_server.connectDatabase(self.config.user_monitoring_db) self.logger.debug('Connected to user_monitoring_db in couchDB')
def __init__(self, config): """ Initialise class members """ BaseDaemon.__init__(self, config, 'RetryManager') try: server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) except Exception, e: self.logger.exception('A problem occured when connecting to couchDB: %s' % e) raise
def __init__(self, config): BaseDaemon.__init__(self, config, 'AsyncTransfer') # Set up a factory for loading plugins self.factory = WMFactory(self.config.pluginDir, namespace = self.config.pluginDir) # Asynch db server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) self.logger.debug('Connected to CouchDB') return
def __init__(self, config): """ Initialise class members """ #Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'DBSPublisher') server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) self.logger.debug('Connected to CouchDB') # Set up a factory for loading plugins self.factory = WMFactory(self.config.schedAlgoDir, namespace = self.config.schedAlgoDir) self.pool = Pool(processes=self.config.publication_pool_size)
def __init__(self, config): """ Initialise class members """ BaseDaemon.__init__(self, config, 'RetryManager') try: server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) except Exception, e: self.logger.exception( 'A problem occured when connecting to couchDB: %s' % e) raise
def __init__(self, config): """ Initialise class members """ #Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'DBSPublisher') server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) self.logger.debug('Connected to CouchDB') # Set up a factory for loading plugins self.factory = WMFactory(self.config.schedAlgoDir, namespace=self.config.schedAlgoDir) self.pool = Pool(processes=self.config.publication_pool_size)
def __init__(self, config): BaseDaemon.__init__(self, config, 'Statistics') server = CouchServer(dburl=self.config.couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.db = server.connectDatabase(self.config.files_database) config_server = CouchServer(dburl=self.config.config_couch_instance, ckey=self.config.opsProxy, cert=self.config.opsProxy) self.config_db = config_server.connectDatabase(self.config.config_database) self.mon_db = server.connectDatabase(self.config.mon_database) self.logger.debug('Connected to CouchDB') statserver = CouchServer(self.config.couch_statinstance) self.statdb = statserver.connectDatabase(self.config.statitics_database) self.logger.debug('Connected to Stat CouchDB') self.iteration_docs = [] self.exptime = None
def __init__(self, config): """ Initialise class members """ #Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'AsyncTransfer') self.pool = Pool(processes=self.config.pool_size) # Set up a factory for loading plugins self.factory = WMFactory(self.config.schedAlgoDir, namespace = self.config.schedAlgoDir) self.dropbox_dir = '%s/dropbox/inputs' % self.config.componentDir if not os.path.isdir(self.dropbox_dir): try: os.makedirs(self.dropbox_dir) except OSError, e: if e.errno == errno.EEXIST: pass else: self.logger.error('Unknown error in mkdir' % e.errno) raise
def __init__(self, config): """ Initialise class members """ #Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'AsyncTransfer') self.pool = Pool(processes=self.config.pool_size) # Set up a factory for loading plugins self.factory = WMFactory(self.config.schedAlgoDir, namespace=self.config.schedAlgoDir) self.dropbox_dir = '%s/dropbox/inputs' % self.config.componentDir if not os.path.isdir(self.dropbox_dir): try: os.makedirs(self.dropbox_dir) except OSError, e: if e.errno == errno.EEXIST: pass else: self.logger.error('Unknown error in mkdir' % e.errno) raise
def __init__(self, config): """ Initialise class members: 1. check and create dropbox dir 2. define oracle and couch (config and file instance) server connection 3. PhEDEx connection 4. Setup wmcore factory """ self.doc_acq = '' # Need a better way to test this without turning off this next line BaseDaemon.__init__(self, config, 'AsyncTransfer') self.dropbox_dir = '%s/dropbox/outputs' % self.config.componentDir if not os.path.isdir(self.dropbox_dir): try: os.makedirs(self.dropbox_dir) except OSError as e: if not e.errno == errno.EEXIST: self.logger.exception('Unknown error in mkdir' % e.errno) raise if not os.path.isdir("/tmp/DashboardReport"): try: os.makedirs("/tmp/DashboardReport") except OSError as e: if not e.errno == errno.EEXIST: self.logger.exception('Unknown error in mkdir' % e.errno) raise try: config_server = CouchServer(dburl=self.config.config_couch_instance) self.config_db = config_server.connectDatabase(self.config.config_database) except: self.logger.exception('Failed when contacting local couch') raise try: self.oracleDB = HTTPRequests(self.config.oracleDB, self.config.opsProxy, self.config.opsProxy) except: self.logger.exception('Failed when contacting Oracle') raise self.pool = Pool(processes=self.config.pool_size) self.factory = WMFactory(self.config.schedAlgoDir, namespace=self.config.schedAlgoDir) self.site_tfc_map = {} try: self.phedex = PhEDEx(responseType='xml', dict={'key':self.config.opsProxy, 'cert':self.config.opsProxy}) except Exception as e: self.logger.exception('PhEDEx exception: %s' % e) raise # TODO: decode xml try: self.phedex2 = PhEDEx(responseType='json', dict={'key':self.config.opsProxy, 'cert':self.config.opsProxy}) except Exception as e: self.logger.exception('PhEDEx exception: %s' % e) raise self.logger.debug(type((self.phedex2.getNodeMap())['phedex']['node'])) for site in [x['name'] for x in self.phedex2.getNodeMap()['phedex']['node']]: if site and str(site) != 'None' and str(site) != 'unknown': self.site_tfc_map[site] = self.get_tfc_rules(site) self.logger.debug('tfc site: %s %s' % (site, self.get_tfc_rules(site)))