當前位置: 首頁>>代碼示例>>Python>>正文


Python Proxy.logonRenewMyProxy方法代碼示例

本文整理匯總了Python中WMCore.Credential.Proxy.Proxy.logonRenewMyProxy方法的典型用法代碼示例。如果您正苦於以下問題:Python Proxy.logonRenewMyProxy方法的具體用法?Python Proxy.logonRenewMyProxy怎麽用?Python Proxy.logonRenewMyProxy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WMCore.Credential.Proxy.Proxy的用法示例。


在下文中一共展示了Proxy.logonRenewMyProxy方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_proxy

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def get_proxy(self, ad):
     result = None
     vo = 'cms'
     group = ''
     role = ''
     if 'CRAB_UserVO' in ad and ad['CRAB_UserVO']:
         vo = ad['CRAB_UserVO']
     if 'CRAB_UserGroup' in ad and ad['CRAB_UserGroup'] and ad['CRAB_UserGroup'] != classad.Value.Undefined:
         group = ad['CRAB_UserGroup']
     if 'CRAB_UserRole' in ad and ad['CRAB_UserRole'] and ad['CRAB_UserRole'] != classad.Value.Undefined:
         role = ad['CRAB_UserRole']
     proxycfg = {'vo': vo,
                 'logger': self.logger,
                 'myProxySvr': self.config.Services.MyProxy,
                 'myproxyAccount': self.config.TaskWorker.resturl,
                 'proxyValidity' : '144:0',
                 'min_time_left' : MINPROXYLENGTH, ## do we need this ? or should we use self.myproxylen? 
                 'userDN' : ad['CRAB_UserDN'],
                 'group' : group,
                 'role' : role,
                 'server_key': self.config.MyProxy.serverhostkey,
                 'server_cert': self.config.MyProxy.serverhostcert,
                 'serverDN': self.config.MyProxy.serverdn,
                 'uisource': getattr(self.config.MyProxy, 'uisource', ''),
                 'credServerPath': self.config.MyProxy.credpath,
                 'cleanEnvironment' : getattr(self.config.MyProxy, 'cleanEnvironment', False)}
     proxy = Proxy(proxycfg)
     userproxy = proxy.getProxyFilename(serverRenewer=True)
     proxy.logonRenewMyProxy()
     timeleft = proxy.getTimeLeft(userproxy)
     if timeleft is None or timeleft <= 0:
         self.logger.error("Impossible to retrieve proxy from %s for %s." %(proxycfg['myProxySvr'], proxycfg['userDN']))
         raise Exception("Failed to retrieve proxy.")
     return userproxy
開發者ID:belforte,項目名稱:CRABServer,代碼行數:36,代碼來源:RenewRemoteProxies.py

示例2: execute

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def execute(self, *args, **kwargs):
     result = None
     proxycfg = {'vo': kwargs['task']['tm_user_vo'],
                 'logger': self.logger,
                 'myProxySvr': self.config.Services.MyProxy,
                 'proxyValidity' : '144:0',
                 'min_time_left' : 36000, ## do we need this ? or should we use self.myproxylen? 
                 'userDN' : kwargs['task']['tm_user_dn'],
                 'group' : kwargs['task']['tm_user_group'] if kwargs['task']['tm_user_group'] else '',
                 'role' : kwargs['task']['tm_user_role'] if kwargs['task']['tm_user_role'] else '',
                 'server_key': self.config.MyProxy.serverhostkey,
                 'server_cert': self.config.MyProxy.serverhostcert,
                 'serverDN': self.config.MyProxy.serverdn,
                 'uisource': getattr(self.config.MyProxy, 'uisource', ''),
                 'credServerPath': self.config.MyProxy.credpath,
                 'myproxyAccount' : self.server['host'],
                 'cleanEnvironment' : getattr(self.config.MyProxy, 'cleanEnvironment', False)
                }
     proxy = Proxy(proxycfg)
     userproxy = proxy.getProxyFilename(serverRenewer=True)
     proxy.logonRenewMyProxy()
     timeleft = proxy.getTimeLeft(userproxy)
     if timeleft is None or timeleft <= 0:
         msg = "Impossible to retrieve proxy from %s for %s." % (proxycfg['myProxySvr'], proxycfg['userDN'])
         raise TaskWorkerException(msg)
     else:
         kwargs['task']['user_proxy'] = userproxy
         result = Result(task=kwargs['task'], result='OK')
     return result
開發者ID:HassenRiahi,項目名稱:CRABServer,代碼行數:31,代碼來源:MyProxyLogon.py

示例3: execute

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def execute(self, *args, **kwargs):
     result = None
     proxycfg = {'vo': kwargs['task']['tm_user_vo'],
                 'logger': self.logger,
                 'myProxySvr': self.config.Services.MyProxy,
                 'proxyValidity' : '144:0',
                 'min_time_left' : 36000, ## do we need this ? or should we use self.myproxylen? 
                 'userDN' : kwargs['task']['tm_user_dn'],
                 'group' : kwargs['task']['tm_user_group'] if kwargs['task']['tm_user_group'] else '',
                 'role' : kwargs['task']['tm_user_role'] if kwargs['task']['tm_user_role'] else '',
                 'server_key': self.config.MyProxy.serverhostkey,
                 'server_cert': self.config.MyProxy.serverhostcert,
                 'serverDN': self.config.MyProxy.serverdn,
                 'uisource': getattr(self.config.MyProxy, 'uisource', ''),
                 'credServerPath': self.config.MyProxy.credpath,
                 'myproxyAccount' : self.server['host'],
                 'cleanEnvironment' : getattr(self.config.MyProxy, 'cleanEnvironment', False)
                }
     # WMCore proxy methods are awfully verbode, reduce logging level when using them
     with tempSetLogLevel(logger=self.logger, level=logging.ERROR):
         proxy = Proxy(proxycfg)
         userproxy = proxy.getProxyFilename(serverRenewer=True)
         proxy.logonRenewMyProxy()
         timeleft = proxy.getTimeLeft(userproxy)
         usergroups = set(proxy.getAllUserGroups(userproxy))
     if timeleft is None or timeleft <= 0:
         msg = "Impossible to retrieve proxy from %s for %s." % (proxycfg['myProxySvr'], proxycfg['userDN'])
         self.logger.error(msg)
         self.logger.error("\n Will try again in verbose mode")
         self.logger.error("===========PROXY ERROR START ==========================")
         with tempSetLogLevel(logger=self.logger, level=logging.DEBUG):
             userproxy = proxy.getProxyFilename(serverRenewer=True)
             proxy.logonRenewMyProxy()
             timeleft = proxy.getTimeLeft(userproxy)
             usergroups = set(proxy.getAllUserGroups(userproxy))
         self.logger.error("===========PROXY ERROR END   ==========================")
         raise TaskWorkerException(msg)
     else:
         kwargs['task']['user_proxy'] = userproxy
         kwargs['task']['user_groups'] = usergroups
         self.logger.debug("Valid proxy for %s now in %s", proxycfg['userDN'], userproxy)
         result = Result(task=kwargs['task'], result='OK')
     return result
開發者ID:belforte,項目名稱:CRABServer,代碼行數:45,代碼來源:MyProxyLogon.py

示例4: get_proxy

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def get_proxy(self, ad):
     result = None
     vo = "cms"
     group = ""
     role = ""
     if "CRAB_UserVO" in ad and ad["CRAB_UserVO"]:
         vo = ad["CRAB_UserVO"]
     if "CRAB_UserGroup" in ad and ad["CRAB_UserGroup"] and ad["CRAB_UserGroup"] != classad.Value.Undefined:
         group = ad["CRAB_UserGroup"]
     if "CRAB_UserRole" in ad and ad["CRAB_UserRole"] and ad["CRAB_UserRole"] != classad.Value.Undefined:
         role = ad["CRAB_UserRole"]
     print vo, group, role
     proxycfg = {
         "vo": vo,
         "logger": self.logger,
         "myProxySvr": self.config.Services.MyProxy,
         "myproxyAccount": self.config.TaskWorker.resturl,
         "proxyValidity": "144:0",
         "min_time_left": MINPROXYLENGTH,  ## do we need this ? or should we use self.myproxylen?
         "userDN": ad["CRAB_UserDN"],
         "group": group,
         "role": role,
         "server_key": self.config.MyProxy.serverhostkey,
         "server_cert": self.config.MyProxy.serverhostcert,
         "serverDN": self.config.MyProxy.serverdn,
         "uisource": getattr(self.config.MyProxy, "uisource", ""),
         "credServerPath": self.config.MyProxy.credpath,
         "cleanEnvironment": getattr(self.config.MyProxy, "cleanEnvironment", False),
     }
     proxy = Proxy(proxycfg)
     userproxy = proxy.getProxyFilename(serverRenewer=True)
     proxy.logonRenewMyProxy()
     timeleft = proxy.getTimeLeft(userproxy)
     if timeleft is None or timeleft <= 0:
         self.logger.error(
             "Impossible to retrieve proxy from %s for %s." % (proxycfg["myProxySvr"], proxycfg["userDN"])
         )
         raise Exception("Failed to retrieve proxy.")
     return userproxy
開發者ID:nizamyusli,項目名稱:CRABServer,代碼行數:41,代碼來源:RenewRemoteProxies.py

示例5: execute

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def execute(self, *args, **kwargs):
     result = None
     proxycfg = {
         "vo": kwargs["task"]["tm_user_vo"],
         "logger": self.logger,
         "myProxySvr": self.config.Services.MyProxy,
         "proxyValidity": "24:0",
         "min_time_left": 36000,  ## do we need this ? or should we use self.myproxylen?
         "userDN": kwargs["task"]["tm_user_dn"],
         "group": kwargs["task"]["tm_user_group"] if kwargs["task"]["tm_user_group"] else "",
         "role": kwargs["task"]["tm_user_role"] if kwargs["task"]["tm_user_role"] else "",
         "server_key": self.config.MyProxy.serverhostkey,
         "server_cert": self.config.MyProxy.serverhostcert,
         "serverDN": self.config.MyProxy.serverdn,
         "uisource": self.config.MyProxy.uisource,
         "credServerPath": self.config.MyProxy.credpath,
     }
     proxy = Proxy(proxycfg)
     userproxy = proxy.getProxyFilename(serverRenewer=True)
     proxy.logonRenewMyProxy()
     timeleft = proxy.getTimeLeft(userproxy)
     if timeleft is None or timeleft <= 0:
         msg = "Impossible to retrieve proxy from %s for %s." % (proxycfg["myProxySvr"], proxycfg["userDN"])
         self.logger.error("Setting %s as failed" % str(kwargs["task"]["tm_taskname"]))
         configreq = {
             "workflow": kwargs["task"]["tm_taskname"],
             "status": "FAILED",
             "subresource": "failure",
             "failure": b64encode(msg),
         }
         self.logger.error(str(configreq))
         self.server.post(self.resturl, data=urllib.urlencode(configreq))
         raise StopHandler(msg)
     else:
         kwargs["task"]["user_proxy"] = userproxy
         result = Result(task=kwargs["task"], result="OK")
     return result
開發者ID:bbockelm,項目名稱:CAFTaskWorker,代碼行數:39,代碼來源:MyProxyLogon.py

示例6: getProxy

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
def getProxy(userdn, group, role, defaultDelegation, logger):
    """
    _getProxy_
    """
    log.debug("Retrieving proxy for %s" % userdn)
    proxy = Proxy(defaultDelegation)
    proxyPath = proxy.getProxyFilename( True )
    timeleft = proxy.getTimeLeft( proxyPath )
    if timeleft is not None and timeleft > 3600:
        return (True, proxyPath)
    proxyPath = proxy.logonRenewMyProxy()
    timeleft = proxy.getTimeLeft( proxyPath )
    if timeleft is not None and timeleft > 0:
        return (True, proxyPath)
    return (False, None)
開發者ID:TonyWildish,項目名稱:ASO-monitor,代碼行數:17,代碼來源:__init__.py

示例7: execute

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
 def execute(self, *args, **kwargs):
     result = None
     proxycfg = {'vo': kwargs['task']['tm_user_vo'],
                 'logger': self.logger,
                 'myProxySvr': self.config.Services.MyProxy,
                 'proxyValidity' : '144:0',
                 'min_time_left' : 36000, ## do we need this ? or should we use self.myproxylen? 
                 'userDN' : kwargs['task']['tm_user_dn'],
                 'group' : kwargs['task']['tm_user_group'] if kwargs['task']['tm_user_group'] else '',
                 'role' : kwargs['task']['tm_user_role'] if kwargs['task']['tm_user_role'] else '',
                 'server_key': self.config.MyProxy.serverhostkey,
                 'server_cert': self.config.MyProxy.serverhostcert,
                 'serverDN': self.config.MyProxy.serverdn,
                 'uisource': getattr(self.config.MyProxy, 'uisource', ''),
                 'credServerPath': self.config.MyProxy.credpath,
                 'myproxyAccount' : self.server['host'],
                 'cleanEnvironment' : getattr(self.config.MyProxy, 'cleanEnvironment', False)
                }
     proxy = Proxy(proxycfg)
     userproxy = proxy.getProxyFilename(serverRenewer=True)
     proxy.logonRenewMyProxy()
     timeleft = proxy.getTimeLeft(userproxy)
     if timeleft is None or timeleft <= 0:
         msg = "Impossible to retrieve proxy from %s for %s." %(proxycfg['myProxySvr'], proxycfg['userDN'])
         self.logger.error("Setting %s as failed" % str(kwargs['task']['tm_taskname']))
         configreq = {'workflow': kwargs['task']['tm_taskname'],
                      'status': "FAILED",
                      'subresource': 'failure',
                      'failure': b64encode(msg)}
         self.logger.error(str(configreq))
         self.server.post(self.resturi, data = urllib.urlencode(configreq))
         raise StopHandler(msg)
     else:
         kwargs['task']['user_proxy'] = userproxy
         result = Result(task=kwargs['task'], result='OK')
     return result
開發者ID:khurtado,項目名稱:CRABServer,代碼行數:38,代碼來源:MyProxyLogon.py

示例8: getProxy

# 需要導入模塊: from WMCore.Credential.Proxy import Proxy [as 別名]
# 或者: from WMCore.Credential.Proxy.Proxy import logonRenewMyProxy [as 別名]
def getProxy(config, userdn, group, role):
    """
    _getProxy_
    """
    defaultDelegation = getDefaultDelegation(config, "cms", "myproxy.cern.ch", threading.currentThread().logger)
    defaultDelegation['userDN'] = userdn
    defaultDelegation['group'] = group
    defaultDelegation['role'] = role

    logging.debug("Retrieving proxy for %s" % userdn)
    proxy = Proxy(defaultDelegation)
    proxyPath = proxy.getProxyFilename( True )
    timeleft = proxy.getTimeLeft( proxyPath )
    if timeleft is not None and timeleft > 3600:
        return (True, proxyPath)
    proxyPath = proxy.logonRenewMyProxy()
    timeleft = proxy.getTimeLeft( proxyPath )
    if timeleft is not None and timeleft > 0:
        return (True, proxyPath)
    return (False, None)
開發者ID:stuartw,項目名稱:WMCore,代碼行數:22,代碼來源:TaskArchiverPoller.py


注:本文中的WMCore.Credential.Proxy.Proxy.logonRenewMyProxy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。