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


Python FileCatalogClient.getFileSize方法代码示例

本文整理汇总了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
开发者ID:besdiracgrid,项目名称:BESDIRAC,代码行数:69,代码来源:Badger.py


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