本文整理汇总了Python中rucio.client.Client.add_datasets_to_container方法的典型用法代码示例。如果您正苦于以下问题:Python Client.add_datasets_to_container方法的具体用法?Python Client.add_datasets_to_container怎么用?Python Client.add_datasets_to_container使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rucio.client.Client
的用法示例。
在下文中一共展示了Client.add_datasets_to_container方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerContainer
# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_datasets_to_container [as 别名]
def registerContainer(self,cname,datasets=[],presetScope=None):
if cname.endswith('/'):
cname = cname[:-1]
# register container
client = RucioClient()
try:
scope,dsn = self.extract_scope(cname)
if presetScope is not None:
scope = presetScope
client.add_container(scope=scope, name=cname)
except DataIdentifierAlreadyExists:
pass
# add files
if len(datasets) > 0:
try:
dsns = []
for ds in datasets:
ds_scope, ds_name = self.extract_scope(ds)
if ds_scope:
dsn = {'scope': ds_scope, 'name': ds_name}
else:
dsn = {'scope': scope, 'name': ds}
dsns.append(dsn)
client.add_datasets_to_container(scope=scope, name=cname, dsns=dsns)
except DuplicateContent:
for ds in dsns:
try:
client.add_datasets_to_container(scope=scope, name=cname, dsns=[ds])
except DuplicateContent:
pass
return True