当前位置: 首页>>代码示例>>Python>>正文


Python Client.set_status方法代码示例

本文整理汇总了Python中rucio.client.Client.set_status方法的典型用法代码示例。如果您正苦于以下问题:Python Client.set_status方法的具体用法?Python Client.set_status怎么用?Python Client.set_status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rucio.client.Client的用法示例。


在下文中一共展示了Client.set_status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: closeDataset

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import set_status [as 别名]
 def closeDataset(self,dsn):
     # register dataset
     client = RucioClient()
     try:
         scope,dsn = self.extract_scope(dsn)
         client.set_status(scope,dsn,open=False)
     except (UnsupportedOperation,DataIdentifierNotFound):
         pass
     return True
开发者ID:PanDAWMS,项目名称:panda-server,代码行数:11,代码来源:DDM.py

示例2: registerDataset

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import set_status [as 别名]
 def registerDataset(self,dsn,lfns=[],guids=[],sizes=[],checksums=[],lifetime=None,scope=None,metadata=None):
     presetScope = scope
     files = []
     for lfn, guid, size, checksum in zip(lfns, guids, sizes, checksums):
         if lfn.find(':') > -1:
             s, lfn = lfn.split(':')[0], lfn.split(':')[1]
         else:
             s = scope
         file = {'scope': s, 'name': lfn, 'bytes': size, 'meta': {'guid': guid}}
         if checksum.startswith('md5:'):
             file['md5'] = checksum[4:]
         elif checksum.startswith('ad:'):
             file['adler32'] = checksum[3:]
         files.append(file)
     # register dataset
     client = RucioClient()
     try:
         scope,dsn = self.extract_scope(dsn)
         if presetScope is not None:
             scope = presetScope
         client.add_dataset(scope=scope, name=dsn, meta=metadata)
         if lifetime != None:
             client.set_metadata(scope,dsn,key='lifetime',value=lifetime*86400)
     except DataIdentifierAlreadyExists:
         pass
     # open dataset just in case
     try:
         client.set_status(scope,dsn,open=True)
     except:
         pass
     # add files
     if len(files) > 0:
         iFiles = 0
         nFiles = 1000
         while iFiles < len(files):
             tmpFiles = files[iFiles:iFiles+nFiles]
             try:
                 client.add_files_to_dataset(scope=scope,name=dsn,files=tmpFiles, rse=None)
             except FileAlreadyExists:
                 for f in tmpFiles:
                     try:
                         client.add_files_to_dataset(scope=scope, name=dsn, files=[f], rse=None)
                     except FileAlreadyExists:
                         pass
             iFiles += nFiles
     vuid = hashlib.md5(scope+':'+dsn).hexdigest()
     vuid = '%s-%s-%s-%s-%s' % (vuid[0:8], vuid[8:12], vuid[12:16], vuid[16:20], vuid[20:32])
     duid = vuid
     return {'duid': duid, 'version': 1, 'vuid': vuid}
开发者ID:PanDAWMS,项目名称:panda-server,代码行数:51,代码来源:DDM.py


注:本文中的rucio.client.Client.set_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。