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


Python Client.list_replicas方法代碼示例

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


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

示例1: getZipFiles

# 需要導入模塊: from rucio.client import Client [as 別名]
# 或者: from rucio.client.Client import list_replicas [as 別名]
 def getZipFiles(self, dids, rses):
     try:
         client = RucioClient()
         data = []
         iGUID = 0
         nGUID = 1000
         retVal = {}
         for did in dids:
             iGUID += 1
             scope, lfn = did.split(':')
             data.append({'scope':scope,'name':lfn})
             if len(data) % nGUID == 0 or iGUID == len(dids):
                 for tmpDict in client.list_replicas(data):
                     tmpScope = str(tmpDict['scope'])
                     tmpLFN = str(tmpDict['name'])
                     tmpDID = '{0}:{1}'.format(tmpScope, tmpLFN)
                     tmpRses = tmpDict['rses'].keys()
                     # RSE selection
                     for pfn, pfnData in tmpDict['pfns'].iteritems():
                         if (rses is None or pfnData['rse'] in rses) and pfnData['domain'] == 'zip':
                             zipFileName = pfn.split('/')[-1]
                             zipFileName = re.sub('\?.+$', '', zipFileName)
                             retVal[tmpDID] = client.get_metadata(tmpScope, zipFileName)
                             break
                 data = []
         return True, retVal
     except:
         errType, errVale = sys.exc_info()[:2]
         return False, '%s %s' % (errType,errVale)
開發者ID:PanDAWMS,項目名稱:panda-server,代碼行數:31,代碼來源:DDM.py

示例2: resolve_replicas

# 需要導入模塊: from rucio.client import Client [as 別名]
# 或者: from rucio.client.Client import list_replicas [as 別名]
    def resolve_replicas(self, files, protocols):

        # build list of local ddmendpoints: group by site
        # load ALL ddmconf
        self.ddmconf.update(self.si.resolveDDMConf([]))
        ddms = {}
        for ddm, dat in self.ddmconf.iteritems():
            ddms.setdefault(dat['site'], []).append(dat)

        for fdat in files:

            # build and order list of local ddms
            ddmdat = self.ddmconf.get(fdat.ddmendpoint)
            if not ddmdat:
                raise Exception("Failed to resolve ddmendpoint by name=%s send by Panda job, please check configuration. fdat=%s" % (fdat.ddmendpoint, fdat))
            if not ddmdat['site']:
                raise Exception("Failed to resolve site name of ddmendpoint=%s. please check ddm declaration: ddmconf=%s ... fdat=%s" % (fdat.ddmendpoint, ddmconf, fdat))
            localddms = ddms.get(ddmdat['site'])
            # sort/filter ddms (as possible input source)
            fdat.inputddms = self._prepare_input_ddm(ddmdat, localddms)

        # load replicats from Rucio
        from rucio.client import Client
        c = Client()

        dids = [dict(scope=e.scope, name=e.lfn) for e in files]
        schemes = ['srm', 'root', 'https', 'gsiftp']

        # Get the replica list
        try:
            replicas = c.list_replicas(dids, schemes=schemes)
        except Exception, e:
            raise PilotException("Failed to get replicas from Rucio: %s" % e, code=PilotErrors.ERR_FAILEDLFCGETREPS)
開發者ID:complynx,項目名稱:pilot,代碼行數:35,代碼來源:mover.py

示例3: listFileReplicas

# 需要導入模塊: from rucio.client import Client [as 別名]
# 或者: from rucio.client.Client import list_replicas [as 別名]
 def listFileReplicas(self,scopes,lfns,rses=None):
     try:
         client = RucioClient()
         dids = []
         iGUID = 0
         nGUID = 1000
         retVal = {}
         for scope,lfn in zip(scopes,lfns):
             iGUID += 1
             dids.append({'scope':scope,'name':lfn})
             if len(dids) % nGUID == 0 or iGUID == len(lfns):
                 for tmpDict in client.list_replicas(dids):
                     tmpLFN = str(tmpDict['name'])
                     tmpRses = tmpDict['rses'].keys()
                     # RSE selection
                     if rses is not None:
                         newRSEs = []
                         for tmpRse in tmpRses:
                             if tmpRse in rses:
                                 newRSEs.append(tmpRse)
                         tmpRses = newRSEs
                     if len(tmpRses) > 0:
                         retVal[tmpLFN] = tmpRses
                 dids = []
         return True,retVal
     except:
         errType,errVale = sys.exc_info()[:2]
         return False,'%s %s' % (errType,errVale)
開發者ID:PanDAWMS,項目名稱:panda-server,代碼行數:30,代碼來源:DDM.py


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