当前位置: 首页>>代码示例>>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;未经允许,请勿转载。