當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。