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


Python WorkflowSpec.addPythonLibrary方法代码示例

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


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

示例1: ExpressWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import addPythonLibrary [as 别名]
class ExpressWorkflow(FactoryInterface):
    """
    _ExpressFactory_

    Util to build workflows for express processing jobs
    
    """
    def __init__(self, runNumber, version, globalTag, cmsPath, scramArch, *outModuleInfo):
        FactoryInterface.__init__(self, version, cmsPath, scramArch)
        self.run = runNumber
        self.outputModules = list(outModuleInfo)
        self.globalTag = globalTag


    def buildConfiguration(self, configFile, enableLazyDownload):
        """
        _buildConfiguration_

        mostly just a method to take the passed in information

        """
        outputModuleDetails = {}

        for moduleInfo in self.outputModules:

            if moduleInfo.has_key("dataset"):
                moduleName = "write_%s_%s_%s" % (moduleInfo["stream"],
                                                 moduleInfo["dataset"],
                                                 moduleInfo["dataTier"])
            else:
                moduleName = "write_%s_%s" % (moduleInfo["stream"],
                                              moduleInfo["dataTier"])

            outputModuleDetails[moduleName] = {
                "Stream" : moduleInfo["stream"],
                "primaryDataset" : moduleInfo.get("dataset", None),
                "processedDataset" : moduleInfo.get("processedDataset", None),
                "dataTier" : moduleInfo["dataTier"],
                "acquisitionEra" : moduleInfo["acquisitionEra"],
                "processingVersion" : moduleInfo["processingVersion"],
##                "globalTag" : moduleInfo["globalTag"],
                "compressionLevel" : 3
                }

            if moduleInfo.has_key("triggerPaths"):
                selEvents = [ "%s:%s" % (x, moduleInfo["process"])
                              for x in moduleInfo["triggerPaths"] ]
                outputModuleDetails[moduleName]["SelectEvents"] = selEvents
            else:
                outputModuleDetails[moduleName]["SelectEvents"] = None

        cfgInterface = self.createConfiguration(sourceType = "NewEventStreamFileReader",
                                                configFile = configFile,
                                                enableLazyDownload = enableLazyDownload,
                                                outputModuleDetails = outputModuleDetails,
                                                setEventContentInOutput = True,
                                                compressionLevel = 3)

        return cfgInterface


    def makeWorkflowSpec(self, name, configFile, enableLazyDownload):
        """
        _makeWorkflowSpec_

        Create a workflow spec instance

        """
        #  //
        # // Initialise basic workflow
        #//
        self.workflow = WorkflowSpec()
        self.workflow.setWorkflowName(name)
        self.workflow.setRequestCategory("data")
        self.workflow.setRequestTimestamp(int(time.time()))
        self.workflow.parameters["WorkflowType"] = "Repack"
        self.workflow.parameters["RequestLabel"] = name
        self.workflow.parameters["ProdRequestID"] = self.run
        self.workflow.parameters["RunNumber"] = self.run
        self.workflow.parameters["CMSSWVersion"] = self.cmssw["CMSSWVersion"] 
        self.workflow.parameters["ScramArch"] = self.cmssw["ScramArch"] 
        self.workflow.parameters["CMSPath"] = self.cmssw["CMSPath"]

        # runtime support for StreamerJobEntity
        self.workflow.addPythonLibrary("T0.DataStructs")

        cmsRunNode = self.workflow.payload
        cmsRunNode.name = "cmsRun1"
        cmsRunNode.type = "CMSSW"
        cmsRunNode.application["Version"] = self.cmssw["CMSSWVersion"]
        cmsRunNode.application["Executable"] = "cmsRun"
        cmsRunNode.application["Project"] = "CMSSW"
        cmsRunNode.application["Architecture"] = self.cmssw["ScramArch"]

        # runtime express script
        cmsRunNode.scriptControls["PreExe"].append(
            "T0.ExpressInjector.RuntimeExpress")
        
        # build the configuration template for the workflow
        cmsRunNode.cfgInterface = self.buildConfiguration(configFile, enableLazyDownload)
#.........这里部分代码省略.........
开发者ID:TonyWildish,项目名称:CSA06-T0-prototype,代码行数:103,代码来源:ExpressWorkflow.py

示例2: RepackWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import addPythonLibrary [as 别名]
class RepackWorkflow(FactoryInterface):
    """
    _RepackFactory_

    Util to build workflows for accumulator or merge repacker jobs
    
    """
    def __init__(self, runNumber, version, cmsPath, scramArch, *outModuleInfo):
        FactoryInterface.__init__(self, version, cmsPath, scramArch)
        self.run = runNumber
        self.outputModules = list(outModuleInfo)


    def buildConfiguration(self, enableLazyDownload):
        """
        _buildConfiguration_

        Using a RepackerConfigMaker instance, generate a template
        config file

        """
        outputModuleDetails = {}

        for moduleInfo in self.outputModules:

            moduleName = "write_%s_%s_%s" % (moduleInfo["stream"],
                                             moduleInfo["dataset"],
                                             moduleInfo["dataTier"])

            outputModuleDetails[moduleName] = {
                "Stream" : moduleInfo["stream"],
                "algorithm" : None,
                "primaryDataset" : moduleInfo.get("dataset", None),
                "processedDataset" : moduleInfo.get("processedDataset", None),
                "dataTier" : moduleInfo["dataTier"],
                "filterName" : None,
                "acquisitionEra" : moduleInfo["acquisitionEra"],
                "processingVersion" : moduleInfo["processingVersion"],
                "globalTag" : moduleInfo["globalTag"],
                "LFNBase" : None,
                "MergedLFNBase" : None,
                "compressionLevel" : 6
                }

            if moduleInfo.has_key("triggerPaths"):
                selEvents = [ "%s:%s" % (x, moduleInfo["process"])
                              for x in moduleInfo["triggerPaths"] ]
                outputModuleDetails[moduleName]["SelectEvents"] = selEvents
            else:
                outputModuleDetails[moduleName]["SelectEvents"] = None

        cfgInterface = self.createConfiguration(sourceType = "NewEventStreamFileReader",
                                                processName = "REPACKER",
                                                configName = "repack-config",
                                                enableLazyDownload = enableLazyDownload,
                                                outputModuleDetails = outputModuleDetails)

        return cfgInterface


    def makeWorkflow(self, name, enableLazyDownload):
        """
        _makeWorkflow_

        Create a workflow spec instance for the run provided

        """
        #  //
        # // Initialise basic workflow
        #//
        self.workflow = WorkflowSpec()
        self.workflow.setWorkflowName(name)
        self.workflow.setRequestCategory("data")
        self.workflow.setRequestTimestamp(int(time.time()))
        self.workflow.parameters["WorkflowType"] = "Repack"
        self.workflow.parameters["RequestLabel"] = name
        self.workflow.parameters["ProdRequestID"] = self.run
        self.workflow.parameters["RunNumber"] = self.run
        self.workflow.parameters["CMSSWVersion"] = self.cmssw["CMSSWVersion"] 
        self.workflow.parameters["ScramArch"] = self.cmssw["ScramArch"] 
        self.workflow.parameters["CMSPath"] = self.cmssw["CMSPath"]

        # runtime support for StreamerJobEntity
        self.workflow.addPythonLibrary("T0.DataStructs")

        cmsRunNode = self.workflow.payload
        cmsRunNode.name = "cmsRun1"
        cmsRunNode.type = "CMSSW"
        cmsRunNode.application["Version"] = self.cmssw["CMSSWVersion"]
        cmsRunNode.application["Executable"] = "cmsRun"
        cmsRunNode.application["Project"] = "CMSSW"
        cmsRunNode.application["Architecture"] = self.cmssw["ScramArch"]

        # runtime repacker script
        cmsRunNode.scriptControls["PreExe"].append(
            "T0.RepackerInjector.RuntimeRepacker")
        
        # build the configuration template for the workflow
        cmsRunNode.cfgInterface = self.buildConfiguration(enableLazyDownload)
        if cmsRunNode.cfgInterface == None:
#.........这里部分代码省略.........
开发者ID:TonyWildish,项目名称:CSA06-T0-prototype,代码行数:103,代码来源:RepackWorkflow.py


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