本文整理匯總了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