Пример #1
0
    def __call__(self):
        if self.inputLFN == None:
            msg = "No --lfn specified"
            raise RuntimeError(msg)

        outputs = []
        outputs.append( { 'moduleLabel' : "write_PrimDS1_RAW" } )
        outputs.append( { 'moduleLabel' : "write_PrimDS2_RAW" } )
        if self.selectEvents != None:
            outputs[0]['selectEvents'] = self.selectEvents.split(',')
            outputs[1]['selectEvents'] = self.selectEvents.split(',')

        try:
            process = repackProcess(outputs = outputs)
        except Exception as ex:
            msg = "Error creating process for Repack:\n"
            msg += str(ex)
            raise RuntimeError(msg)

        process.source.fileNames.append(self.inputLFN)

        import FWCore.ParameterSet.Config as cms

        process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )

        psetFile = open("RunRepackCfg.py", "w")
        psetFile.write(process.dumpPython())
        psetFile.close()
        cmsRun = "cmsRun -e RunRepackCfg.py"
        print("Now do:\n%s" % cmsRun)
Пример #2
0
    def __call__(self):
        if self.inputLFN == None:
            msg = "No --lfn specified"
            raise RuntimeError(msg)

        outputs = []
        outputs.append( { 'moduleLabel' : "write_PrimDS1_RAW" } )
        outputs.append( { 'moduleLabel' : "write_PrimDS2_RAW" } )
        if self.selectEvents != None:
            outputs[0]['selectEvents'] = self.selectEvents.split(',')
            outputs[1]['selectEvents'] = self.selectEvents.split(',')

        try:
            process = repackProcess(outputs = outputs)
        except Exception as ex:
            msg = "Error creating process for Repack:\n"
            msg += str(ex)
            raise RuntimeError(msg)

        process.source.fileNames.append(self.inputLFN)

        import FWCore.ParameterSet.Config as cms

        process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )

        psetFile = open("RunRepackCfg.py", "w")
        psetFile.write(process.dumpPython())
        psetFile.close()
        cmsRun = "cmsRun -e RunRepackCfg.py"
        print("Now do:\n%s" % cmsRun)
Пример #3
0
    def repack(self, **options):
        """
        _repack_

        builds a repack configuration

        """
        msg = "Scenario Implementation %s\n" % self.__class__.__name__
        return repackProcess(**options)
Пример #4
0
    def repack(self, **options):
        """
        _repack_

        builds a repack configuration

        """
        msg = "Scenario Implementation %s\n" % self.__class__.__name__
        return repackProcess(**options)
Пример #5
0
def create_process(args, func_args):

    if args.funcname == "merge":
        if args.useErrorDataset:
            func_args['outputmod_label'] = "MergedError"

        try:
            from Configuration.DataProcessing.Merge import mergeProcess
            process = mergeProcess(**func_args)
        except Exception as ex:
            msg = "Failed to create a merge process."
            print(msg)
            raise ex
    elif args.funcname == "repack":
        try:
            from Configuration.DataProcessing.Repack import repackProcess
            process = repackProcess(**func_args)
        except Exception as ex:
            msg = "Failed to create a repack process."
            print(msg)
            raise ex
    else:
        try:
            from Configuration.DataProcessing.GetScenario import getScenario
            scenario = func_args['scenario']
            scenarioInst = getScenario(scenario)
        except Exception as ex:
            msg = "Failed to retrieve the Scenario named "
            msg += str(scenario)
            msg += "\nWith Error:"
            msg += str(ex)
            print(msg)
            raise ex
        try:
            my_func = getattr(scenarioInst, args.funcname)
            arg_names = my_func.__code__.co_varnames[1:1 + my_func.__code__.
                                                     co_argcount]
            #the last arg should be **args - get the others from the dictionary passed in
            arg_names = arg_names[:-1]
            call_func_args = []
            for name in arg_names:
                call_func_args.append(func_args[name])
                del func_args[name]
            process = my_func(*call_func_args, **func_args)
        except Exception as ex:
            msg = "Failed to load process from Scenario %s (%s)." % (
                scenario, scenarioInst)
            print(msg)
            raise ex

    return process
Пример #6
0
    def createProcess(self, scenario, funcName, funcArgs):
        """
        _createProcess_

        Create a Configuration.DataProcessing PSet.

        """
        if funcName == "merge":

            baggage = self.job.getBaggage()
            if getattr(baggage, "useErrorDataset", False):
                funcArgs["outputmod_label"] = "MergedError"

            try:
                from Configuration.DataProcessing.Merge import mergeProcess

                self.process = mergeProcess(**funcArgs)
            except Exception as ex:
                msg = "Failed to create a merge process."
                print(msg)
                raise ex
        elif funcName == "repack":
            try:
                from Configuration.DataProcessing.Repack import repackProcess

                self.process = repackProcess(**funcArgs)
            except Exception as ex:
                msg = "Failed to create a repack process."
                print(msg)
                raise ex
        else:
            try:
                from Configuration.DataProcessing.GetScenario import getScenario

                scenarioInst = getScenario(scenario)
            except Exception as ex:
                msg = "Failed to retrieve the Scenario named "
                msg += str(scenario)
                msg += "\nWith Error:"
                msg += str(ex)
                print(msg)
                raise ex
            try:
                self.process = getattr(scenarioInst, funcName)(**funcArgs)
            except Exception as ex:
                msg = "Failed to load process from Scenario %s (%s)." % (scenario, scenarioInst)
                print(msg)
                raise ex

        return
Пример #7
0
class SetupCMSSWPset(ScriptInterface):
    """
    _SetupCMSSWPset_

    """
    fixupDict = {
        "process.GlobalTag.globaltag": fixupGlobalTag,
        "process.GlobalTag.DBParameters.transactionId":
        fixupGlobalTagTransaction,
        "process.source.fileNames": fixupFileNames,
        "process.source.secondaryFileNames": fixupSecondaryFileNames,
        "process.maxEvents.input": fixupMaxEvents,
        "process.source.skipEvents": fixupSkipEvents,
        "process.source.firstEvent": fixupFirstEvent,
        "process.source.firstRun": fixupFirstRun,
        "process.source.lastRun": fixupLastRun,
        "process.source.lumisToProcess": fixupLumisToProcess,
        "process.source.firstLuminosityBlock": fixupFirstLumi
    }

    def createProcess(self, scenario, funcName, funcArgs):
        """
        _createProcess_

        Create a Configuration.DataProcessing PSet.

        """
        if funcName == "merge":

            baggage = self.job.getBaggage()
            if getattr(baggage, "useErrorDataset", False):
                funcArgs['outputmod_label'] = "MergedError"

            try:
                from Configuration.DataProcessing.Merge import mergeProcess
                self.process = mergeProcess(**funcArgs)
            except Exception, ex:
                msg = "Failed to create a merge process."
                print msg
                return None
        elif funcName == "repack":
            try:
                from Configuration.DataProcessing.Repack import repackProcess
                self.process = repackProcess(**funcArgs)
            except Exception, ex:
                msg = "Failed to create a repack process."
                print msg
                return None
Пример #8
0
    def createProcess(self, scenario, funcName, funcArgs):
        """
        _createProcess_

        Create a Configuration.DataProcessing PSet.

        """
        if funcName == "merge":

            baggage = self.job.getBaggage()
            if getattr(baggage, "useErrorDataset", False):
                funcArgs['outputmod_label'] = "MergedError"

            try:
                from Configuration.DataProcessing.Merge import mergeProcess
                self.process = mergeProcess(**funcArgs)
            except Exception as ex:
                msg = "Failed to create a merge process."
                print(msg)
                raise ex
        elif funcName == "repack":
            try:
                from Configuration.DataProcessing.Repack import repackProcess
                self.process = repackProcess(**funcArgs)
            except Exception as ex:
                msg = "Failed to create a repack process."
                print(msg)
                raise ex
        else:
            try:
                from Configuration.DataProcessing.GetScenario import getScenario
                scenarioInst = getScenario(scenario)
            except Exception as ex:
                msg = "Failed to retrieve the Scenario named "
                msg += str(scenario)
                msg += "\nWith Error:"
                msg += str(ex)
                print(msg)
                raise ex
            try:
                self.process = getattr(scenarioInst, funcName)(**funcArgs)
            except Exception as ex:
                msg = "Failed to load process from Scenario %s (%s)." % (
                    scenario, scenarioInst)
                print(msg)
                raise ex

        return
Пример #9
0
    def __call__(self):
        if self.inputLFN == None:
            msg = "No --lfn specified"
            raise RuntimeError, msg

        outputs = []
        outputs.append({'moduleLabel': "write_PrimDS1_RAW"})
        outputs.append({'moduleLabel': "write_PrimDS2_RAW"})
        if self.selectEvents != None:
            outputs[0]['selectEvents'] = self.selectEvents.split(',')
            outputs[1]['selectEvents'] = self.selectEvents.split(',')

        try:
            process = repackProcess(outputs=outputs)
        except Exception, ex:
            msg = "Error creating process for Repack:\n"
            msg += str(ex)
            raise RuntimeError, msg
Пример #10
0
    def __call__(self):
        if self.inputLFN == None:
            msg = "No --lfn specified"
            raise RuntimeError, msg

        outputs = []
        outputs.append( { 'moduleLabel' : "write_PrimDS1_RAW" } )
        outputs.append( { 'moduleLabel' : "write_PrimDS2_RAW" } )
        if self.selectEvents != None:
            outputs[0]['selectEvents'] = self.selectEvents.split(',')
            outputs[1]['selectEvents'] = self.selectEvents.split(',')

        try:
            process = repackProcess(outputs = outputs)
        except Exception, ex:
            msg = "Error creating process for Repack:\n"
            msg += str(ex)
            raise RuntimeError, msg