class ProductionJobTestCase( unittest.TestCase ): """ Base class for the ProductionJob test cases """ def setUp(self): """set up the objects""" super(ProductionJobTestCase, self).setUp() self.prodJob = ProductionJob() self.prodJob.energy=250.0 def test_Energy250( self ): """ProductionJob getEnergyPath 250gev...........................................................""" self.prodJob.energy = Decimal('250.0') res = self.prodJob.getEnergyPath() self.assertEqual( "250gev/", res ) def test_Energy350( self ): """ProductionJob getEnergyPath 350gev...........................................................""" self.prodJob.energy = 350.0 res = self.prodJob.getEnergyPath() self.assertEqual( "350gev/", res ) def test_Energy3000( self ): """ProductionJob getEnergyPatt 3tev.............................................................""" self.prodJob.energy = 3000.0 res = self.prodJob.getEnergyPath() self.assertEqual( "3tev/", res ) def test_Energy1400( self ): """ProductionJob getEnergyPath 1.4tev ..........................................................""" self.prodJob.energy = 1400.0 res = self.prodJob.getEnergyPath() self.assertEqual( "1.4tev/", res )
def getProductionJob(self): """ return production job instance with some parameters set """ from ILCDIRAC.Interfaces.API.NewInterface.ProductionJob import ProductionJob prodJob = ProductionJob() prodJob.setLogLevel(self.productionLogLevel) prodJob.setProdGroup(self.prodGroup) prodJob.setOutputSE(self.outputSE) prodJob.basepath = self.basepath prodJob.dryrun = self._flags.dryRun prodJob.maxFCFoldersToCheck = 1 return prodJob
slicpandora_ov.setDetectorModel(detectorName) slicpandora_ov.setPandoraSettings(pandoraSettings) slicpandora_ov.getInputFromApp(lcsim_prepandora_ov) slicpandora_ov.setOutputFile('pandora.slcio') lcsim_postpandora_ov = LCSIM() lcsim_postpandora_ov.setVersion(lcsimVers) lcsim_postpandora_ov.getInputFromApp(slicpandora_ov) lcsim_postpandora_ov.setSteeringFile(lcsimSteering2) lcsim_postpandora_ov.setTrackingStrategy(strategies) lcsim_postpandora_ov.setDetectorModel(detectorName) ####################################################33 ##Now define the productions pslic = ProductionJob() pslic.setInputDataQuery(meta) res = pslic.append(slic) if not res['OK']: print res['Message'] exit(1) pslic.addFinalization(True,True,True,True) pslic.setProdType("MCSimulation") pslic.setProdGroup(prodGroup) pslic.setWorkflowName(workflowName+'_sim_sid_cdr') pslic.setCPUTime(cpuLimit) pslic.setOutputSE("CERN-SRM") pslic.setDescription('Simulating '+workflowDescription) res = pslic.createProduction() if not res['OK']:
def createSplitProduction( self, meta, prodName, parameterDict, eventsPerJob, eventsPerBaseFile, limited=False ): """ create splitting transformation for splitting files """ gLogger.notice( "*"*80 + "\nCreating split production: %s " % prodName ) from ILCDIRAC.Interfaces.API.NewInterface.ProductionJob import ProductionJob splitProd = ProductionJob() splitProd.setProdPlugin( 'Limited' if limited else 'Standard' ) splitProd.setProdType( 'Split' ) splitProd.setLogLevel( self.productionLogLevel ) splitProd.dryrun = self._flags.dryRun res = splitProd.setInputDataQuery(meta) if not res['OK']: raise RuntimeError( 'Split production: failed to set inputDataQuery: %s' % res['Message'] ) splitProd.setOutputSE( self.outputSE ) splitProd.setWorkflowName( self._productionName( meta, parameterDict, 'stdhepSplit' ) ) splitProd.setProdGroup( self.prodGroup ) #Add the application res = splitProd.append( self.createSplitApplication( eventsPerJob, eventsPerBaseFile, 'stdhep' ) ) if not res['OK']: raise RuntimeError( 'Split production: failed to append application: %s' % res['Message'] ) splitProd.addFinalization(True,True,True,True) description = 'Splitting stdhep files' splitProd.setDescription( description ) res = splitProd.createProduction() if not res['OK']: raise RuntimeError( "Failed to create split production: %s " % res['Message'] ) splitProd.addMetadataToFinalFiles( { "BeamParticle1": parameterDict['pname1'], "BeamParticle2": parameterDict['pname2'], "EPA_B1": parameterDict['epa_b1'], "EPA_B2": parameterDict['epa_b2'], } ) res = splitProd.finalizeProd() if not res['OK']: raise RuntimeError( 'Split production: failed to finalize: %s' % res['Message'] ) return splitProd.getMetadata()
def createReconstructionProduction( self, meta, prodName, parameterDict ): """ create reconstruction production """ gLogger.notice( "*"*80 + "\nCreating reconstruction production: %s " % prodName ) from ILCDIRAC.Interfaces.API.NewInterface.ProductionJob import ProductionJob recProd = ProductionJob() recProd.dryrun = self._flags.dryRun recProd.setLogLevel( self.productionLogLevel ) productionType = 'MCReconstruction_Overlay' if self._flags.over else 'MCReconstruction' recProd.setProdType( productionType ) recProd.setClicConfig( self.clicConfig ) res = recProd.setInputDataQuery( meta ) if not res['OK']: raise RuntimeError( "Error setting inputDataQuery for Reconstruction production: %s " % res['Message'] ) recProd.setOutputSE( self.outputSE ) recType = 'rec_overlay' if self._flags.over else 'rec' recProd.setWorkflowName( self._productionName( meta, parameterDict, recType ) ) recProd.setProdGroup( self.prodGroup ) #Add overlay if needed if self._flags.over: res = recProd.append( self.createOverlayApplication( float( meta['Energy'] ) ) ) if not res['OK']: raise RuntimeError( "Error appending overlay to reconstruction transformation: %s" % res['Message'] ) #Add reconstruction res = recProd.append( self.createMarlinApplication( float( meta['Energy'] ) ) ) if not res['OK']: raise RuntimeError( "Error appending Marlin to reconstruction production: %s" % res['Message'] ) recProd.addFinalization(True,True,True,True) description = "CLICDet2017 %s" % meta['Energy'] description += "Overlay" if self._flags.over else "No Overlay" if prodName: description += ", %s"%prodName recProd.setDescription( description ) res = recProd.createProduction() if not res['OK']: raise RuntimeError( "Error creating reconstruction production: %s" % res['Message'] ) recProd.addMetadataToFinalFiles( { 'BeamParticle1': parameterDict['pname1'], 'BeamParticle2': parameterDict['pname2'], 'EPA_B1': parameterDict['epa_b1'], 'EPA_B2': parameterDict['epa_b2'], } ) res = recProd.finalizeProd() if not res['OK']: raise RuntimeError( "Error finalising reconstruction production: %s " % res['Message'] ) reconstructionMeta = recProd.getMetadata() return reconstructionMeta
def createSimulationProduction( self, meta, prodName, parameterDict ): """ create simulation production """ gLogger.notice( "*"*80 + "\nCreating simulation production: %s " % prodName ) from ILCDIRAC.Interfaces.API.NewInterface.ProductionJob import ProductionJob simProd = ProductionJob() simProd.dryrun = self._flags.dryRun simProd.setLogLevel( self.productionLogLevel ) simProd.setProdType( 'MCSimulation' ) simProd.setClicConfig( self.clicConfig ) res = simProd.setInputDataQuery( meta ) if not res['OK']: raise RuntimeError( "Error creating Simulation Production: %s" % res['Message'] ) simProd.setOutputSE( self.outputSE ) simProd.setWorkflowName( self._productionName( meta, parameterDict, 'sim') ) simProd.setProdGroup( self.prodGroup ) #Add the application res = simProd.append( self.createDDSimApplication() ) if not res['OK']: raise RuntimeError( "Error creating simulation Production: %s" % res[ 'Message' ] ) simProd.addFinalization(True,True,True,True) description = "Model: %s" % self.detectorModel if prodName: description += ", %s"%prodName simProd.setDescription( description ) res = simProd.createProduction() if not res['OK']: raise RuntimeError( "Error creating simulation production: %s" % res['Message'] ) simProd.addMetadataToFinalFiles( { 'BeamParticle1': parameterDict['pname1'], 'BeamParticle2': parameterDict['pname2'], 'EPA_B1': parameterDict['epa_b1'], 'EPA_B2': parameterDict['epa_b2'], } ) res = simProd.finalizeProd() if not res['OK']: raise RuntimeError( "Error finalizing simulation production: %s" % res[ 'Message' ] ) simulationMeta = simProd.getMetadata() return simulationMeta
slicpandora_ov.setDetectorModel(detectorName) slicpandora_ov.setPandoraSettings(pandoraSettings) slicpandora_ov.getInputFromApp(lcsim_prepandora_ov) slicpandora_ov.setOutputFile('pandora.slcio') lcsim_postpandora_ov = LCSIM() lcsim_postpandora_ov.setVersion(lcsimVers) lcsim_postpandora_ov.getInputFromApp(slicpandora_ov) lcsim_postpandora_ov.setSteeringFile(lcsimSteering2) lcsim_postpandora_ov.setTrackingStrategy(strategies) lcsim_postpandora_ov.setDetectorModel(detectorName) ####################################################33 ##Now define the productions pslic = ProductionJob() pslic.setInputDataQuery(meta) res = pslic.append(slic) if not res['OK']: print res['Message'] exit(1) pslic.addFinalization(True, True, True, True) pslic.setProdType("MCSimulation") pslic.setProdGroup(prodGroup) pslic.setWorkflowName(workflowName + '_sim_sid_cdr') pslic.setCPUTime(cpuLimit) pslic.setOutputSE("CERN-SRM") pslic.setDescription('Simulating ' + workflowDescription) res = pslic.createProduction() if not res['OK']:
slicpandora_ov.setDetectorModel('clic_sid_cdr') slicpandora_ov.setPandoraSettings("PandoraSettingsSlic.xml") slicpandora_ov.setOutputFile('pandora.slcio') lcsim_postpandora_ov = LCSIM() lcsim_postpandora_ov.getInputFromApp(slicpandora_ov) lcsim_postpandora_ov.setVersion('CLIC_CDR') lcsim_postpandora_ov.setSteeringFile("clic_cdr_postPandoraOverlay.lcsim") lcsim_postpandora_ov.setTrackingStrategy("defaultStrategies_clic_sid_cdr.xml") #lcsim_postpandora_ov.setDetectorModel('clic_sid_cdr') if gen: ########################################## ##Define the generation production. pwh = ProductionJob() pwh.setLogLevel("verbose") pwh.setOutputSE("CERN-SRM") pwh.setProdType("MCGeneration") wname = process+"_"+str(energy) if additionnalreqs: wname += "_forced_decay" if cut: wname += "_cut" wname += prod_name pwh.setWorkflowName(wname) pwh.setProdGroup(analysis+"_"+str(energy)) res = pwh.append(wh) if not res['OK']: print res['Message'] exit(1)
slicpandora_ov.setDetectorModel("clic_sid_cdr") slicpandora_ov.setPandoraSettings("PandoraSettingsSlic.xml") slicpandora_ov.setOutputFile("pandora.slcio") lcsim_postpandora_ov = LCSIM() lcsim_postpandora_ov.getInputFromApp(slicpandora_ov) lcsim_postpandora_ov.setVersion("CLIC_CDR") lcsim_postpandora_ov.setSteeringFile("clic_cdr_postPandoraOverlay.lcsim") lcsim_postpandora_ov.setTrackingStrategy("defaultStrategies_clic_sid_cdr.xml") # lcsim_postpandora_ov.setDetectorModel('clic_sid_cdr') if gen: ########################################## ##Define the generation production. pwh = ProductionJob() pwh.setLogLevel("verbose") pwh.setOutputSE("CERN-SRM") pwh.setProdType("MCGeneration") wname = process + "_" + str(energy) if additionnalreqs: wname += "_forced_decay" if cut: wname += "_cut" wname += additional_name pwh.setWorkflowName(wname) pwh.setProdGroup(analysis + "_" + str(energy)) res = pwh.append(wh) if not res["OK"]: print res["Message"] exit(1)
overlay = OverlayInput() overlay.setBXOverlay(60) overlay.setGGToHadInt(1.3)##When running at 1.4TeV overlay.setDetectorModel("CLIC_ILD_CDR") overlay.setBkgEvtType("gghad") ##Reconstruction ma = Marlin() ma.setVersion('v0111Prod') ma.setSteeringFile("clic_ild_cdr_steering.xml") ma.setGearFile("clic_ild_cdr.gear") ########################################## ##Define the generation production. pwh = ProductionJob() pwh.setOutputSE("CERN-SRM") pwh.setProdType("MCGeneration") pwh.setWorkflowName(process+"_"+str(energy)) pwh.setProdGroup(process+"_"+str(energy)) res = pwh.append(wh) if not res['OK']: print res['Message'] exit(1) pwh.addFinalization(True,True,True,True) pwh.setDescription("CLIC 1.4Tev BeamSpread, ISR ON, whizard") res = pwh.createProduction() if not res['OK']: print res['Message']
def setUp(self): """set up the objects""" super(ProductionJobTestCase, self).setUp() self.prodJob = ProductionJob() self.prodJob.energy=250.0