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


Python WorkflowSpec.setWorkflowName方法代码示例

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


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

示例1: createCleanupWorkflowSpec

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
def createCleanupWorkflowSpec():
    """
    _createCleanupWorkflowSpec_

    Create a generic cleanup WorkflowSpec definition
    that can be used to generate a sanbox for cleanup jobs

    """
    timestamp = str(time.asctime(time.localtime(time.time())))
    timestamp = timestamp.replace(" ", "-")
    timestamp = timestamp.replace(":", "_")
    workflow = WorkflowSpec()
    workflow.setWorkflowName("CleanUp-%s" % timestamp)
    workflow.setActivity("CleanUp")
    workflow.setRequestCategory("mc-cleanup")
    workflow.setRequestTimestamp(timestamp)
    workflow.parameters['WorkflowType']="CleanUp"
    

    cleanUp = workflow.payload
    cleanUp.name = "cleanUp1"
    cleanUp.type = "CleanUp" 
    
    cleanUp.application["Project"] = ""
    cleanUp.application["Version"] = ""
    cleanUp.application["Architecture"] = ""
    cleanUp.application["Executable"] = "RuntimeCleanUp.py" # binary name
    cleanUp.configuration = ""
    cleanUp.cfgInterface = None


    return workflow
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:34,代码来源:CleanUpTools.py

示例2: createProductionWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
def createProductionWorkflow(prodName, cmsswVersion, cfgFile = None,
                             category = "mc", **args):
    """
    _createProductionWorkflow_

    Create a Production style workflow, ie generation of new events

    """

    timestamp = int(time.time())
    if args.get("PyCfg", None) == None:
        if cfgFile == None:
            msg = "Error: No Cfg File or python cfg file provided to createProductionWorkflow"
            raise RuntimeError, msg
        pycfgFile = createPythonConfig(cfgFile)
        pycfgFileContent = file(pycfgFile).read()
    else:
        pycfgFileContent = args['PyCfg']



    if args.get("PSetHash", None) == None:
        realPSetHash = createPSetHash(cfgFile)
    else:
        realPSetHash = args['PSetHash']


    #  //
    # // Create a new WorkflowSpec and set its name
    #//
    spec = WorkflowSpec()
    workflowname = "%s__%s-%s-%s-%s"%(prodName,cmsswVersion,args.get("processingLabel","Test07"),args.get("physicsGroup","NoPhysicsGroup"),timestamp)
    spec.setWorkflowName(workflowname)
    spec.setRequestCategory(category)
    spec.setRequestTimestamp(timestamp)

    cmsRun = spec.payload
    populateCMSRunNode(cmsRun, "cmsRun1", cmsswVersion, pycfgFileContent, realPSetHash,
                       timestamp, prodName, physicsGroup = args.get("physicsGroup", "NoPhysicsGroup"), processingLabel=args.get("processingLabel", "Test07"), fakeHash = args.get("FakeHash", False))


    addStageOutNode(cmsRun, "stageOut1")
    generateFilenames(spec)
    return spec
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:46,代码来源:WorkflowTools.py

示例3: createLogCollectorWorkflowSpec

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
def createLogCollectorWorkflowSpec(wf):
    """
    _createLogColectorWorkflowSpec_

    Create a generic LogArchive WorkflowSpec definition

    """
    timestamp = str(time.asctime(time.localtime(time.time())))
    timestamp = timestamp.replace(" ", "-")
    timestamp = timestamp.replace(":", "_")
    workflow = WorkflowSpec()
    workflow.setWorkflowName("LogCollect-%s" % timestamp)
    workflow.setActivity("LogCollect")
    workflow.setRequestCategory("logcollect")
    workflow.setRequestTimestamp(timestamp)
    workflow.parameters["WorkflowType"] = "LogCollect"

    logArchive = workflow.payload
    logArchive.name = "logCollect1"
    logArchive.type = "LogCollect"
    # TODO: remove this?
    # logArchive.workflow = wf
    logArchive.configuration
    logArchive.application["Project"] = ""
    logArchive.application["Version"] = ""
    logArchive.application["Architecture"] = ""
    logArchive.application["Executable"] = "RuntimeLogCollector.py"  # binary name
    logArchive.configuration = ""
    logArchive.cfgInterface = None

    # set stageOut override
    # cfg = IMProvNode("config")
    # stageOut = IMProvNode("StageOutParameters")
    # cfg.addNode()
    # WorkflowTools.addStageOutNode(logArchive, "StageOut1")
    # WorkflowTools.addStageOutOverride(logArchive, stageOutParams['command'],
    #                                  stageOutParams['option'],
    #                                  stageOutParams['se-name'],
    #                                  stageOutParams['lfnPrefix'])

    return workflow
开发者ID:jlexternal,项目名称:WPrime13TeV,代码行数:43,代码来源:LogCollectorTools.py

示例4: PromptRecoWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]

#.........这里部分代码省略.........

        cfgWrapper = self.workflow.payload.cfgInterface
        outputModule = cfgWrapper.getOutputModule(outputModuleName)

        outputModule["catalog"] = '%s-Catalog.xml' % outputModule['Name']
        outputModule["primaryDataset"] = self.primaryDataset
        outputModule["processedDataset"] = self.processedDataset
        outputModule["dataTier"] = dataTier
        outputModule["acquisitionEra"] = self.acquisitionEra
        outputModule["processingVersion"] = self.processingVersion

        outputDataset["LFNBase"] = getLFN(outputModule, self.run, Unmerged = True)
        outputDataset["MergedLFNBase"] = getLFN(outputModule, self.run)
        outputModule["LFNBase"] = outputDataset["LFNBase"]
        outputModule["MergedLFNBase"] = outputDataset["MergedLFNBase"]

        outputModule["fileName"] = "%s.root" % outputModule['Name']

        outputModule["logicalFileName"] = os.path.join(
            outputDataset["LFNBase"], "PromptReco.%s.root" % dataTier)

        return
    
    def makeWorkflow(self):
        """
        _makeWorkflow_

        Generate a workflow.  If the self.configFile parameter has been set
        this will attempt to load the config from file, otherwise it will
        create an empty process object which will get filled in by the runtime
        script.
        """
        self.timestamp = int(time.time())
        self.workflow = WorkflowSpec()
        self.workflowName = "PromptReco-Run%s-%s" % (self.run,
                                                     self.primaryDataset)

        self.workflow.setWorkflowName(self.workflowName)
        self.workflow.setRequestCategory("data")
        self.workflow.setRequestTimestamp(self.timestamp)
        self.workflow.parameters["WorkflowType"] = "Processing"
        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"]

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

        inputDataset = self.cmsRunNode.addInputDataset(self.primaryDataset,
                                                       self.parentProcessedDataset)
        inputDataset["DataTier"] = "RAW"
        
        if self.configFile == None:
            self.loadProcessFromFramework()            
        else:
            self.loadProcessFromFile()

        WorkflowTools.addStageOutNode(self.cmsRunNode, "stageOut1")
        WorkflowTools.addLogArchNode(self.cmsRunNode, "logArchive")
        WorkflowTools.generateFilenames(self.workflow)

        return self.workflow

    def loadProcessFromFile(self):
        """
        _loadProcessFromFile_

        Load the config file into the workflow.
        """
        preExecScript = self.cmsRunNode.scriptControls["PreExe"]
        preExecScript.append("T0.PromptRecoInjector.RuntimePromptReco")
        
        cfgBaseName = os.path.basename(self.configFile).replace(".py", "")
        cfgDirName = os.path.dirname(self.configFile)
        modPath = imp.find_module(cfgBaseName, [cfgDirName])

        loader = CMSSWAPILoader(self.cmssw["ScramArch"],
                                self.cmssw["CMSSWVersion"],
                                self.cmssw["CMSPath"])
        
        try:
            loader.load()
        except Exception, ex:
            logging.error("Couldn't load CMSSW libraries: %s" % ex)
            return None
        
        try:
            modRef = imp.load_module(cfgBaseName, modPath[0],
                                     modPath[1], modPath[2])
        except Exception, ex:
            logging.error("Can't load config: %s" % ex)
            loader.unload()
            return None
开发者ID:TonyWildish,项目名称:CSA06-T0-prototype,代码行数:104,代码来源:PromptRecoWorkflow.py

示例5: createMergeJobWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
def createMergeJobWorkflow(procSpec, isFastMerge = True, doCleanUp = True, littleE = False):
    """
    _createMergeJobWorkflow_

    Given a Processing Workflow, generate a set of Merge Job
    workflows that can be used to generate actual merge jobs 
    (as opposed to creating datasets like createMergeDatasetWorkflow)

    returns a dictionary of (input, IE MergeSensor watched) dataset name
    to workflow spec instances

    """
    mergeDatasetWF = createMergeDatasetWorkflow(procSpec, isFastMerge)
    mergeDatasets = mergeDatasetWF.outputDatasets()

    results = {}

    procSpecName = procSpec.workflowName()
    

    for dataset in mergeDatasets:
        inputDataset = dataset['ParentDataset']

        newWF = WorkflowSpec()
        newWF.parameters.update(procSpec.parameters)
        newWF.setWorkflowName(procSpecName)
        newWF.parameters['WorkflowType'] = "Merge"
        

        cmsRunNode = newWF.payload
        cmsRunNode.name = "cmsRun1"
        cmsRunNode.type = "CMSSW"
        cmsRunNode.application["Project"] = "CMSSW"
        cmsRunNode.application["Version"] = dataset['ApplicationVersion']
        cmsRunNode.application["Architecture"] = "slc3_ia32_gcc323"

        #  //
        # // Hack to forward UserSandbox to Merge Jobs
        #//
        userSandbox = dataset.get("UserSandbox", None)
        if userSandbox != None:
            cmsRunNode.userSandbox = userSandbox

        #if isFastMerge == True:
        #    if littleE:
        #        cmsRunNode.application["Executable"] = "edmFastMerge"
        #    else:
        #        cmsRunNode.application["Executable"] = _FastMergeBinary
        #    outputModuleName = "EdmFastMerge"
        #else:
        cmsRunNode.application["Executable"] = "cmsRun"
        outputModuleName = "Merged"

        #  //
        # // Input Dataset
        #//
        datasetBits = DatasetConventions.parseDatasetPath(inputDataset)
        inDataset = cmsRunNode.addInputDataset(datasetBits['Primary'],
                                               datasetBits['Processed'])
        inDataset["DataTier"] = datasetBits['DataTier']

        #  //
        # // Output Dataset
        #//
        
        outputDataset = cmsRunNode.addOutputDataset(
            dataset['PrimaryDataset'], 
            dataset['ProcessedDataset'], 
            outputModuleName)

        outputDataset["DataTier"] = dataset['DataTier']
        outputDataset["PSetHash"] = dataset['PSetHash']

        outputDataset["ApplicationName"] = \
                    cmsRunNode.application["Executable"]
        outputDataset["ApplicationProject"] = \
                    cmsRunNode.application["Project"]
        outputDataset["ApplicationVersion"] = \
                    cmsRunNode.application["Version"]
        outputDataset["ApplicationFamily"] = outputModuleName
        outputDataset["PhysicsGroup"] = \
                      procSpec.parameters.get('PhysicsGroup', None)
        outputDataset['ParentDataset'] = inputDataset
                
        
        #  //
        # // Add Stage Out node
        #//
        WorkflowTools.addStageOutNode(cmsRunNode, "stageOut1")
        if doCleanUp == True:
            WorkflowTools.addCleanUpNode(cmsRunNode, "cleanUp1")

        #  //
        # // Add log archive node
        #//
        WorkflowTools.addLogArchNode(cmsRunNode, "logArchive")

        WorkflowTools.generateFilenames(newWF)

        
#.........这里部分代码省略.........
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:103,代码来源:MergeTools.py

示例6: ExpressWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [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

示例7: __init__

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
class WorkflowMaker:
    """
    _WorkflowMaker_

    Basic MC workflow maker for PR to use to create workflow spec files.
    
    """
    def __init__(self, requestId, channel, label):
        self.requestId = requestId
        self.group = None
        self.label = label
        self.timestamp = int(time.time())
        self.channel = channel
        self.cmsswVersions = []
        self.configurations = []
        self.psetHashes = {}
        self.origCfgs = {}
        self.acquisitionEra = None
        self.processingString = None
        self.processingVersion = None
        self.conditions = None

        # turn on use of proper naming convention for datasets
        # should be made the default soon, lets deprecate all the old crap
        self.useProperNamingConventions = False
        
        self.options = {}
        self.options.setdefault('FakeHash', False)

        # Should we use another attribute for setting the output dataset
        # status in DBS?
        self.outputDatasetStatus = 'VALID'

        self.inputDataset = {}
        self.inputDataset['IsUsed'] = False
        self.inputDataset['DatasetName'] = None
        self.inputDataset['Primary'] = None
        self.inputDataset['Processed'] = None
        self.inputDataset['DataTier'] = None
        #  //
        # // Extra controls over input dataset if required
        #//
        self.inputDataset['SplitType'] = None
        self.inputDataset['SplitSize'] = None
        self.inputDataset['OnlySites'] = None
        self.inputDataset['OnlyBlocks'] = None
        self.inputDataset['OnlyClosedBlocks'] = True

        #  //
        # // Pileup Dataset controls
        #//
        self.pileupDatasets = []
        
        #  //
        # // Initialise basic workflow
        #//
        self.workflow = WorkflowSpec()
        self.workflowName = "%s-%s-%s" % (label, channel, requestId)
        self.workflow.setWorkflowName(self.workflowName)
        self.workflow.setRequestCategory("mc")
        self.workflow.setRequestTimestamp(self.timestamp)
        self.workflow.parameters['RequestLabel'] = self.label
        self.workflow.parameters['ProdRequestID'] = self.requestId

        self.cmsRunNode = self.workflow.payload
        self.cmsRunNode.name = "cmsRun1"
        self.cmsRunNode.type = "CMSSW"
        
        self.cmsRunNodes = [self.cmsRunNode]
        self.saveOutputFor = []


    def chainCmsRunNode(self, stageOutIntermediates = False, *outputModules):
        """
        append a cmsRun config to the current cmsRun node and chain them
        """
        if stageOutIntermediates: #Do we want to keep cmsRunNode's products?
            self.saveOutputFor.append(self.cmsRunNode.name)    
        newnode = self.cmsRunNode.newNode("cmsRun%s" % 
                                          (len(self.cmsRunNodes) + 1))
        newnode.type = "CMSSW"
        if not outputModules:
            outputModules = self.configurations[-1].outputModules.keys()
        for outmodule in outputModules:
            newnode.addInputLink(self.cmsRunNode.name, outmodule,
                        'source', AppearStandalone = not stageOutIntermediates)
        self.cmsRunNode = newnode
        self.cmsRunNodes.append(newnode)


    def changeCategory(self, newCategory):
        """
        _changeCategory_

        Change the workflow category from the default mc
        that appears in the LFNs

        """
        self.workflow.setRequestCategory(newCategory)
        return
#.........这里部分代码省略.........
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:103,代码来源:WorkflowMaker.py

示例8: int

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [as 别名]
if not os.path.exists(cfgFile):
    msg = "Cfg File Not Found: %s" % cfgFile
    raise RuntimeError, msg


#
# create workflow
#

workflowName = "Tier0MCFeeder-%d" % int(time.time())
scramArch = "slc4_ia32_gcc345"
cmsPath = "/afs/cern.ch/cms/sw"

workflow = WorkflowSpec()
workflow.setWorkflowName(workflowName)
workflow.setRequestCategory("mc")
workflow.setRequestTimestamp(int(time.time()))
workflow.parameters["WorkflowType"] = "Processing"
workflow.parameters["CMSSWVersion"] = version
workflow.parameters["ScramArch"] = scramArch
workflow.parameters["CMSPath"] = cmsPath

# needed for streamed index stageout
workflow.parameters['StreamerIndexDir'] = indexdir

cmsRunNode = workflow.payload
cmsRunNode.name = "cmsRun1"
cmsRunNode.type = "CMSSW"
cmsRunNode.application["Version"] = version
cmsRunNode.application["Executable"] = "cmsRun"
开发者ID:giffels,项目名称:PRODAGENT,代码行数:32,代码来源:createTier0ProductionWorkflow.py

示例9: MergePackWorkflow

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

    Util to build workflows for mergepack 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, configFile):
        """
        _buildConfiguration_

        mostly just a method to take the passed in information

        """
        outputModuleDetails = {}

        for moduleInfo in self.outputModules:

            moduleName = "write_%s_%s_%s" % (moduleInfo["stream"],
                                             moduleInfo["dataset"],
                                             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"],
                }

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

        if configFile == None:

            cfgInterface = self.createConfiguration(sourceType = "PoolSource",
                                                    processName = "MERGEPACKER",
                                                    configName = "mergepacker-config",
                                                    enableLazyDownload = enableLazyDownload,
                                                    outputModuleDetails = outputModuleDetails,
                                                    noEventSort = True)

        else:

            cfgInterface = self.createConfiguration(sourceType = "PoolSource",
                                                    configFile = configFile,
                                                    enableLazyDownload = enableLazyDownload,
                                                    outputModuleTemplate = outputModuleDetails.values()[0],
                                                    noEventSort = True)
                
        return cfgInterface

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

        Create a workflow spec instance
        
        """
        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"]

        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 merge script
        cmsRunNode.scriptControls["PreExe"].append(
            "T0.ExpressMerger.RuntimeExpressMerger"
            )

        # build the configuration template for the workflow
        cmsRunNode.cfgInterface = self.buildConfiguration(enableLazyDownload, configFile)
        if cmsRunNode.cfgInterface == None:
            return None

        # generate Dataset information for workflow from cfgInterface
#.........这里部分代码省略.........
开发者ID:TonyWildish,项目名称:CSA06-T0-prototype,代码行数:103,代码来源:MergePackWorkflow.py

示例10: RepackWorkflow

# 需要导入模块: from ProdCommon.MCPayloads.WorkflowSpec import WorkflowSpec [as 别名]
# 或者: from ProdCommon.MCPayloads.WorkflowSpec.WorkflowSpec import setWorkflowName [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.setWorkflowName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。