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


Python FileCatalogClient.getDatasetParameters方法代码示例

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


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

示例1: __init__

# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import getDatasetParameters [as 别名]

#.........这里部分代码省略.........
            return serr
        else:
            return S_OK("File download successfully.")

    ####################################################################
    # dataset functions
    #
    def registerDataset(self, datasetName, path, conditions):
        """Register a new dataset in DFC. Takes dataset name and string with
           conditions for new dataset as arguments.
           datasetname format:  
           resonance_BossVer_eventtype_round_runL_runH_stream0_datatype
           resonance_BossVer_eventtype_round_runL_runH_streamID_datatype
           type(conditions) is str,like "resonance=jpsi bossVer=655 round=round1"
        """
        fc = self.client
        cli = FileCatalogClientCLI(fc)
        metadataDict = cli._FileCatalogClientCLI__createQuery(conditions)
        metadataDict["Path"] = path
        result = fc.addDataset(datasetName, metadataDict)
        if not result["OK"]:
            print ("Error: %s" % result["Message"])
            return S_ERROR()
        else:
            print "Added dataset %s with conditions %s" % (datasetName, conditions)
            return S_OK()

    def getDatasetDescription(self, datasetName):
        """Return a string containing a description of metadata with which 
           the given dataset was defined.
           Example usage:
           >>> result = badger.getDatasetDescription('psipp_661_data_all_exp2')
        """
        result = self.client.getDatasetParameters(datasetName)
        if not result["OK"]:
            print "ERROR: failed to get status of dataset:", result["Message"]
        else:
            parDict = result["Value"]
        for par, value in parDict.items():
            print par.rjust(20), ":", value

    def getDatasetMetadata(self, datasetName):
        """Return a dict containing a description of metadata with which 
           the given dataset was defined.
           Example usage:
           >>> result = badger.getDatasetMetadata('psipp_661_data_all_exp2')
        """
        result = self.client.getDatasetParameters(datasetName)
        if not result["OK"]:
            print "ERROR: failed to get status of dataset:", result["Message"]
            return S_ERROR(result["Message"])
        else:
            parDict = result["Value"]
            return S_OK(parDict)

    def removeDataset(self, datasetName):
        """remove a dataset
        """
        result = self.client.removeDataset(datasetName)
        if not result["OK"]:
            print "ERROR: failed to remove dataset:", result["Message"]
        else:
            print "Successfully removed dataset", datasetName

    def checkDataset(self, datasetName):
        """ check if the dataset parameters are still valid
开发者ID:besdiracgrid,项目名称:BESDIRAC,代码行数:70,代码来源:Badger.py


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