本文整理汇总了Python中rucio.client.Client.add_replicas方法的典型用法代码示例。如果您正苦于以下问题:Python Client.add_replicas方法的具体用法?Python Client.add_replicas怎么用?Python Client.add_replicas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rucio.client.Client
的用法示例。
在下文中一共展示了Client.add_replicas方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerZipFiles
# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_replicas [as 别名]
def registerZipFiles(self,zipMap):
# no zip files
if len(zipMap) == 0:
return
client = RucioClient()
# loop over all zip files
for zipFileName, zipFileAttr in zipMap.iteritems():
# convert file attribute
zipFile = self.convFileAttr(zipFileAttr, zipFileAttr['scope'])
# loop over all contents
files = []
for conFileAttr in zipFileAttr['files']:
# get scope
scope,dsn = self.extract_scope(conFileAttr['ds'])
# convert file attribute
conFile = self.convFileAttr(conFileAttr, scope)
conFile['type'] = 'FILE'
if 'pfn' in conFile:
del conFile['pfn']
# append files
files.append(conFile)
# register zip file
for rse in zipFileAttr['rse']:
client.add_replicas(rse=rse, files=[zipFile])
# add files
nFiles = 100
iFiles = 0
while iFiles < len(files):
client.add_files_to_archive(scope=zipFile['scope'],
name=zipFile['name'],
files=files[iFiles:iFiles+nFiles])
iFiles += nFiles
示例2: registerFiles
# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_replicas [as 别名]
def registerFiles(self,files,rse):
client = RucioClient()
try:
# add replicas
client.add_replicas(files=files,rse=rse)
except FileAlreadyExists:
pass
try:
# add rule
client.add_replication_rule(files,copies=1,rse_expression=rse)
except DuplicateRule:
pass