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


Python Report.addAttributesToFile方法代码示例

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


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

示例1: inputFileHandler

# 需要导入模块: from WMCore.FwkJobReport import Report [as 别名]
# 或者: from WMCore.FwkJobReport.Report import addAttributesToFile [as 别名]
def inputFileHandler(targets):
    """
    _inputFileHandler_

    coroutine to create input files in the report and dispatch
    sub data down the pipeline

    """
    while True:
        report, node = (yield)
        moduleName = None
        moduleNode = [ x for x in node.children if x.name == "ModuleLabel"][0]
        moduleName = moduleNode.text

        moduleRef = report.addInputSource(moduleName)
        fileRef = report.addInputFile(moduleName)
        fileAttrs = {}
        for subnode in node.children:
            if subnode.name == "Runs":
                targets['Runs'].send( (fileRef, subnode) )
            elif subnode.name == "Branches":
                targets['Branches'].send( (fileRef, subnode) )
            else:
                fileAttrs[subnode.name] = subnode.text

        Report.addAttributesToFile(fileRef, lfn = fileAttrs["LFN"],
                                   pfn = fileAttrs["PFN"], catalog = fileAttrs["Catalog"],
                                   module_label = fileAttrs["ModuleLabel"],
                                   guid = fileAttrs["GUID"], input_type = fileAttrs["InputType"],
                                   input_source_class = fileAttrs["InputSourceClass"],
                                   events = int(fileAttrs["EventsRead"]))

        [fileRef]
开发者ID:mialiu149,项目名称:WMCore,代码行数:35,代码来源:XMLParser.py

示例2: fileHandler

# 需要导入模块: from WMCore.FwkJobReport import Report [as 别名]
# 或者: from WMCore.FwkJobReport.Report import addAttributesToFile [as 别名]
def fileHandler(targets):
    """
    _fileHandler_

    coroutine to create files and handle sub data in the appropriate
    dispatchers

    """
    while True:
        report, node = (yield)
        moduleName = None
        moduleNode = [x for x in node.children if x.name == "ModuleLabel"][0]
        moduleName = moduleNode.text

        moduleRef = report.addOutputModule(moduleName)
        fileRef = report.addOutputFile(moduleName)
        fileAttrs = {}
        for subnode in node.children:
            if subnode.name == "Inputs":
                targets["Inputs"].send((fileRef, subnode))
            elif subnode.name == "Runs":
                targets["Runs"].send((fileRef, subnode))
            elif subnode.name == "Branches":
                targets["Branches"].send((fileRef, subnode))
            else:
                fileAttrs[subnode.name] = subnode.text

        Report.addAttributesToFile(
            fileRef,
            lfn=fileAttrs["LFN"],
            pfn=fileAttrs["PFN"],
            catalog=fileAttrs["Catalog"],
            module_label=fileAttrs["ModuleLabel"],
            guid=fileAttrs["GUID"],
            ouput_module_class=fileAttrs["OutputModuleClass"],
            events=int(fileAttrs["TotalEvents"]),
            branch_hash=fileAttrs["BranchHash"],
        )

        [fileRef]
开发者ID:,项目名称:,代码行数:42,代码来源:


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