def __init__(self, **kwarg): PluginBase.__init__(self, **kwarg) # Set up aCT DB connection self.log = core_utils.make_logger(baseLogger, 'aCT submitter', method_name='__init__') self.actDB = aCTDBPanda(self.log) # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) # Map of role to aCT proxyid self.proxymap = {} # Get proxy info # TODO: better to send aCT the proxy file and let it handle it for role, proxy in self.certs.items(): cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials) uc = arc.UserConfig(cred_type) uc.ProxyPath(str(proxy)) cred = arc.Credential(uc) dn = cred.GetIdentityName() self.log.info("Proxy {0} with DN {1} and role {2}".format(proxy, dn, role)) actp = aCTProxy(self.log) attr = '/atlas/Role='+role proxyid = actp.getProxyId(dn, attr) if not proxyid: raise Exception("Proxy with DN {0} and attribute {1} was not found in proxies table".format(dn, attr)) self.proxymap[role] = proxyid
def __init__(self, **kwarg): PluginBase.__init__(self, **kwarg) # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)
def setUp(self): self.usercfg = arc.UserConfig( arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials)) arc.ServiceEndpointRetrieverPluginTESTControl.endpoints.clear() arc.ServiceEndpointRetrieverPluginTESTControl.status.clear() arc.ServiceEndpointRetrieverPluginTESTControl.condition.clear()
def __init__(self): aCTATLASProcess.__init__(self, ceflavour=['ARC-CE']) # Use production role proxy for checking and removing files # Get DN from configured proxy file cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials) uc = arc.UserConfig(cred_type) uc.ProxyPath(str(self.arcconf.get(['voms', 'proxypath']))) cred = arc.Credential(uc) dn = cred.GetIdentityName() actp = aCTProxy(self.log) # Beware hard-coded production role proxyfile = actp.path(dn, '/atlas/Role=production') if not proxyfile: raise Exception('Could not find proxy with production role in proxy table') self.log.info('set proxy path to %s' % proxyfile) self.uc = arc.UserConfig(cred_type) self.uc.ProxyPath(str(proxyfile)) self.uc.UtilsDirPath(str(arc.UserConfig.ARCUSERDIRECTORY)) # Possible file status self.ok = 0 self.retry = 1 self.failed = 2
def __init__(self, **kwarg): PluginBase.__init__(self, **kwarg) self.hostname = socket.getfqdn() # Set up aCT DB connection self.log = core_utils.make_logger(baseLogger, 'aCT submitter', method_name='__init__') self.actDB = aCTDBPanda(self.log) # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) # Map of role to aCT proxyid self.proxymap = {} # Get proxy info # TODO: better to send aCT the proxy file and let it handle it for role, proxy in self.certs.items(): cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials) uc = arc.UserConfig(cred_type) uc.ProxyPath(str(proxy)) cred = arc.Credential(uc) dn = cred.GetIdentityName() actp = aCTProxy(self.log) attr = '/atlas/Role='+role proxyid = actp.getProxyId(dn, attr) if not proxyid: raise Exception("Proxy with DN {0} and attribute {1} was not found in proxies table".format(dn, attr)) self.proxymap[role] = proxyid
def __init__(self, **kwarg): PluginBase.__init__(self, **kwarg) # Set up aCT DB connection self.log = core_utils.make_logger(baseLogger, 'aCT submitter', method_name='__init__') self.conf = aCTConfigARC() self.actDB = aCTDBPanda(self.log, self.conf.get(["db", "file"])) # Get proxy info # TODO: specify DN in conf instead cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials) uc = arc.UserConfig(cred_type) uc.ProxyPath(str(self.conf.get(['voms', 'proxypath']))) cred = arc.Credential(uc) dn = cred.GetIdentityName() self.log.info("Running under DN %s" % dn) # Set up proxy map (prod/pilot roles) self.proxymap = {} actp = aCTProxy(self.log) for role in self.conf.getList(['voms', 'roles', 'item']): attr = '/atlas/Role=' + role proxyid = actp.getProxyId(dn, attr) if not proxyid: raise Exception( "Proxy with DN {0} and attribute {1} was not found in proxies table" .format(dn, attr)) self.proxymap[role] = proxyid
def setUp(self): self.usercfg = arc.UserConfig(arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)) self.ce = arc.Endpoint() self.ce.URLString = "test.nordugrid.org" self.ce.InterfaceName = "org.nordugrid.tirtest" arc.TargetInformationRetrieverPluginTESTControl.delay = 0 arc.TargetInformationRetrieverPluginTESTControl.targets = [arc.ComputingServiceType()] arc.TargetInformationRetrieverPluginTESTControl.status = arc.EndpointQueryingStatus(arc.EndpointQueryingStatus.SUCCESSFUL)
def __init__(self, **kwarg): self.jobSpecFileFormat = 'json' PluginBase.__init__(self, **kwarg) self.schedulerid = harvester_config.master.harvester_id self.tmpdir = '/tmp' # TODO configurable or common function # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)
def __init__(self, **kwarg): self.jobSpecFileFormat = 'json' BaseMessenger.__init__(self, **kwarg) self.schedulerid = harvester_config.master.harvester_id self.tmpdir = '/tmp' # TODO configurable or common function # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)
def __init__(self, **kwarg): '''Set up DB connection and credentials''' PluginBase.__init__(self, **kwarg) self.dbproxy = DBProxy() self.schedulerid = harvester_config.master.harvester_id # Credential dictionary role: proxy file self.certs = dict(zip([r.split('=')[1] for r in list(harvester_config.credmanager.voms)], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)
def __init__(self, **kwarg): PluginBase.__init__(self, **kwarg) # Credential dictionary role: proxy file self.certs = dict( zip([ r.split('=')[1] for r in list(harvester_config.credmanager.voms) ], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials)
def __init__(self, logger, Interval=3600): self.interval = Interval self.conf = aCTConfig.aCTConfigARC() self.db = aCTDBArc(logger, self.conf.get(["db", "file"])) self.log = logger cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials) self.uc = arc.UserConfig(cred_type) self.uc.CACertificatesDirectory( str(self.conf.get(["voms", "cacertdir"]))) self.voms_proxies = {}
def require_voms_proxy(self): proxy_path = vomsutils.NagiosPluginVomsMixin.require_voms_proxy(self) # self._user_config.KeyPath(self.opts.user_key) # self._user_config.CertificatePath(self.opts.user_cert) if proxy_path: self._user_config.ProxyPath(proxy_path) try: self._user_config.InitializeCredentials() # old API except TypeError: self._user_config.InitializeCredentials( arc.initializeCredentialsType( arc.initializeCredentialsType.RequireCredentials))
def setUp(self): self.usercfg = arc.UserConfig( arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials)) self.ce = arc.Endpoint() self.ce.URLString = "test.nordugrid.org" self.ce.InterfaceName = "org.nordugrid.tirtest" arc.TargetInformationRetrieverPluginTESTControl.delay = 0 arc.TargetInformationRetrieverPluginTESTControl.targets = [ arc.ComputingServiceType() ] arc.TargetInformationRetrieverPluginTESTControl.status = arc.EndpointQueryingStatus( arc.EndpointQueryingStatus.SUCCESSFUL)
def __init__(self, **kwarg): '''Set up DB connection and credentials''' PluginBase.__init__(self, **kwarg) self.dbproxy = DBProxy() self.schedulerid = harvester_config.master.harvester_id # Credential dictionary role: proxy file self.certs = dict( zip([ r.split('=')[1] for r in list(harvester_config.credmanager.voms) ], list(harvester_config.credmanager.outCertFile))) self.cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials)
def setUp(self): self.usercfg = arc.UserConfig( arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials)) self.ce = arc.Endpoint() self.ce.URLString = "test.nordugrid.org" self.ce.InterfaceName = "org.nordugrid.tirtest" self.ce.Capability.append( arc.Endpoint_GetStringForCapability(arc.Endpoint.COMPUTINGINFO)) arc.TargetInformationRetrieverPluginTESTControl.delay = 0 arc.TargetInformationRetrieverPluginTESTControl.targets = [ self.create_test_target() ] arc.TargetInformationRetrieverPluginTESTControl.status = arc.EndpointQueryingStatus( arc.EndpointQueryingStatus.SUCCESSFUL)
def __init__(self): # Get agent name from /path/to/aCTAgent.py self.name = os.path.basename(sys.argv[0])[:-3] self.cluster = '' clusterhost = '' if len(sys.argv) == 2: self.cluster = sys.argv[1] url = urlparse(self.cluster) clusterhost = url.netloc.split(':')[0] if url.netloc else url.path # logger logname = '%s-%s' % (self.name, clusterhost) if clusterhost else self.name self.logger = aCTLogger.aCTLogger(logname, cluster=self.cluster) self.log = self.logger() self.criticallogger = aCTLogger.aCTLogger('aCTCritical', cluster=self.cluster, arclog=False) self.criticallog = self.criticallogger() # config self.conf = aCTConfig.aCTConfigARC() self.tmpdir = str(self.conf.get(['tmp', 'dir'])) # database # TODO: subclasses for arc and condor with respective DBs defined there self.db = aCTDBArc.aCTDBArc(self.log) self.dbcondor = aCTDBCondor(self.log) # ARC Configuration # Credentials will be set by ARC agents for each job or set of jobs # but for now set default credential in config to keep ARC happy cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials) self.uc = arc.UserConfig(cred_type) self.uc.ProxyPath(str(self.conf.get(['voms', 'proxypath']))) self.uc.CACertificatesDirectory( str(self.conf.get(["voms", "cacertdir"]))) timeout = int(self.conf.get(['atlasgiis', 'timeout'])) self.uc.Timeout(timeout) # start time for periodic restart self.starttime = time.time() self.log.info("Started %s for cluster %s", self.name, self.cluster)
def readProxyString(self, proxyStr): """ Read proxy info from a string. Extracting the proxy information is the same as in :meth:~`act.common.aCTProxy.aCTProxy._readProxyFromFile`. Args: proxyStr: A string with proxy content. Returns: A tuple with string DN and string expiry time. """ cred_type = arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials) userconf = arc.UserConfig(cred_type) userconf.CredentialString(str(proxyStr)) cred = arc.Credential(userconf) dn = cred.GetIdentityName() expirytime = datetime.datetime.strptime( cred.GetEndTime().str(arc.UTCTime), "%Y-%m-%dT%H:%M:%SZ") return dn, expirytime
def setUp(self): self.usercfg = arc.UserConfig(arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials)) arc.ServiceEndpointRetrieverPluginTESTControl.endpoints.clear() arc.ServiceEndpointRetrieverPluginTESTControl.status.clear() arc.ServiceEndpointRetrieverPluginTESTControl.condition.clear()
def setUp(self): self.usercfg = arc.UserConfig(arc.initializeCredentialsType(arc.initializeCredentialsType.SkipCredentials))
def setUp(self): self.usercfg = arc.UserConfig( arc.initializeCredentialsType( arc.initializeCredentialsType.SkipCredentials))