當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。