本文整理汇总了Python中DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient.getFileSize方法的典型用法代码示例。如果您正苦于以下问题:Python FileCatalogClient.getFileSize方法的具体用法?Python FileCatalogClient.getFileSize怎么用?Python FileCatalogClient.getFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient
的用法示例。
在下文中一共展示了FileCatalogClient.getFileSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import getFileSize [as 别名]
#.........这里部分代码省略.........
count += 1
else:
if count > 0:
count -= 1
cDict = {"count": count}
self.registerFileMetadata(file, cDict)
countDict[file] = count
else:
print "Failed reCalculate value of count of file %s" % file
countDict[file] = -1
return countDict
def removeFile(self, lfn):
"""remove file on DFC
"""
result = self.client.removeFile(lfn)
if not result["OK"]:
return S_ERROR(result)
else:
return S_OK()
def getPFN(self, lfn):
"""get replicas by lfn"""
result = self.client.getReplicas(lfn)
# print result
if not result["OK"]:
return S_ERROR(result)
else:
return S_OK(result["Value"]["Successful"][lfn]["IHEPD-USER"])
def getSize(self, lfns):
"""get the size of the given lfn"""
result = self.client.getFileSize(lfns)
if result["OK"]:
if result["Value"]["Successful"]:
retVal = result["Value"]["Successful"]
else:
retVal = {}
return retVal
def getFilesByMetadataQuery(self, query):
"""Return a list of LFNs satisfying given query conditions.
Example usage:
>>> brunH_GT_29756adger.getFilesByMetadataQuery('resonance=jpsi bossVer=6.5.5 round=exp1')
['/bes/File/jpsi/6.5.5/data/all/exp1/file1', .....]
"""
# TODO: checking of output, error catching
fc = self.client
# TODO: calling the FileCatalog CLI object and its private method
# is not a good way of doing this! but use it to allow construction of
# the query meantime, until createQuery is made a public method
cli = FileCatalogClientCLI(fc)
metadataDict = cli._FileCatalogClientCLI__createQuery(query)
result = fc.findFilesByMetadata(metadataDict, "/")
if result["OK"]:
lfns = fc.findFilesByMetadata(metadataDict, "/")["Value"]
lfns.sort()
return lfns
else:
print "ERROR: No files found which match query conditions."
return None