def test_setDetectorModel_LFN_succcess(self): """test DDSIm setDetectorModel lfn success......................................................""" detModel = "lfn:/ilc/user/s/sailer/CLIC_o2_v03.tar.gz" ddsim = DDSim() ddsim.setDetectorModel(detModel) self.assertEqual(ddsim.detectorModel, "CLIC_o2_v03") self.assertTrue(detModel in ddsim.inputSB)
def test_setDetectorModel_LFN_succcess( self ): """test DDSIm setDetectorModel lfn success......................................................""" detModel = "lfn:/ilc/user/s/sailer/CLIC_o2_v03.tar.gz" ddsim = DDSim() ddsim.setDetectorModel( detModel ) self.assertEqual( ddsim.detectorModel, "CLIC_o2_v03" ) self.assertTrue( detModel in ddsim.inputSB )
def test_setDetectorModel_TB_success(self): """test DDSIm setDetectorModel tarBall success..................................................""" detModel = "CLIC_o2_v03" ext = ".tar.gz" ddsim = DDSim() ddsim.setDetectorModel(detModel + ext) self.assertEqual(ddsim.detectorModel, detModel) self.assertTrue(detModel + ext in ddsim.inputSB)
def test_setDetectorModel_TB_notLocal( self ): """test DDSIm setDetectorModel tarBall notLocal.................................................""" detModel = "CLIC_o2_v03" ext = ".tgz" ddsim = DDSim() ddsim.setDetectorModel( detModel+ext ) self.assertEqual( ddsim.inputSB, [] ) self.assertEqual( ddsim.detectorModel, detModel )
def test_setDetectorModel_TB_success( self ): """test DDSIm setDetectorModel tarBall success..................................................""" detModel = "CLIC_o2_v03" ext = ".tar.gz" ddsim = DDSim() ddsim.setDetectorModel( detModel+ext ) self.assertEqual( ddsim.detectorModel, detModel ) self.assertTrue( detModel+ext in ddsim.inputSB )
def test_setDetectorModel3( self ): """test DDSIm setDetectorModel is not known.....................................................""" detModel = "ATLAS" ddsim = DDSim() ret = ddsim.setDetectorModel( detModel ) self.assertEqual( ddsim.detectorModel, '' ) self.assertFalse( ret['OK'] ) self.assertIn( "Unknown detector model in ddsim: ATLAS", ret['Message'] )
def test_setDetectorModel3(self): """test DDSIm setDetectorModel is not known.....................................................""" detModel = "ATLAS" ddsim = DDSim() ret = ddsim.setDetectorModel(detModel) self.assertEqual(ddsim.detectorModel, '') self.assertFalse(ret['OK']) self.assertIn("Unknown detector model in ddsim: ATLAS", ret['Message'])
def test_setDetectorModel_TB_notLocal(self): """test DDSIm setDetectorModel tarBall notLocal.................................................""" detModel = "CLIC_o2_v03" ext = ".tgz" ddsim = DDSim() ddsim.setDetectorModel(detModel + ext) self.assertEqual(ddsim.inputSB, []) self.assertEqual(ddsim.detectorModel, detModel)
def test_getKnownDetModels2( self ): """test getKnownDetectorModels success..........................................................""" ddsim = DDSim() ddsim.version = "test" import DIRAC ddsim._ops = create_autospec(DIRAC.ConfigurationSystem.Client.Helpers.Operations.Operations, spec_set=True) ddsim._ops.getOptionsDict.return_value = S_OK({"detModel1":"/path", "detModel2":"/path2"}) ret = ddsim.getKnownDetectorModels() self.assertIn( "detModel1", ret['Value'] ) self.assertTrue( ret['OK'] )
def test_getKnownDetModels2(self): """test getKnownDetectorModels success..........................................................""" ddsim = DDSim() ddsim.version = "test" import DIRAC ddsim._ops = create_autospec( DIRAC.ConfigurationSystem.Client.Helpers.Operations.Operations, spec_set=True) ddsim._ops.getOptionsDict.return_value = S_OK({ "detModel1": "/path", "detModel2": "/path2" }) ret = ddsim.getKnownDetectorModels() self.assertIn("detModel1", ret['Value']) self.assertTrue(ret['OK'])
def createDDSimApplication( self ): """ create DDSim Application """ from ILCDIRAC.Interfaces.API.NewInterface.Applications import DDSim ddsim = DDSim() ddsim.setVersion( self.softwareVersion ) ddsim.setSteeringFile( 'clic_steer.py' ) ddsim.setDetectorModel( self.detectorModel ) return ddsim
def createDDSimApplication( self ): """ create DDSim Application """ from ILCDIRAC.Interfaces.API.NewInterface.Applications import DDSim ddsim = DDSim() ddsim.setVersion( self.softwareVersion ) ddsim.setSteeringFile(self.ddsimSteeringFile) ddsim.setDetectorModel( self.detectorModel ) self._setApplicationOptions("DDSim", ddsim) return ddsim
genfile="LFN:/ilc/prod/ilc/ild/test/temp1/gensplit/500-TDR_ws/3f/run002/E0500-TDR_ws.Pea_lvv.Gwhizard-1.95.eL.pB.I37494.01_000.stdhep" now = datetime.now() simfile="ddsim-data-%s.slcio" % now.strftime("%Y%m%d-%H%M%S") steeringfile="/cvmfs/ilc.desy.de/sw/ILDConfig/v01-17-10-p01/StandardConfig/lcgeo_current/ddsim_steer.py" d= DiracILC(True,"repo.rep") ###In case one wants a loop: comment the folowing. #for i in range(2): j = UserJob() j.setJobGroup("Tutorial") j.setName("DDSim-example") #%i) # j.setInputSandbox(setting_file) ddsim = DDSim() ddsim.setVersion("ILCSoft-01-17-10") ddsim.setDetectorModel("ILD_o1_v05") ddsim.setInputFile(genfile) ddsim.setRandomSeed(12345) # ddsim.setStartFrom(1) ddsim.setNumberOfEvents(5) # Number of events should not exceed number of events in file. # Otherwise, G4exception is thrown # ddsim.setDebug() ddsim.setSteeringFile(steeringfile) ddsim.setOutputFile(simfile) res = j.append(ddsim) if not res['OK']: print res['Message'] exit(1)
mo = Mokka() mo.setVersion(SOFTWAREVERSION) #mo.setNbEvts(10) if energy in [500., 420., 375., 350., 250.]: mo.setSteeringFile("clic_ild_cdr500.steer") elif energy in [3000., 1400.]: mo.setSteeringFile("clic_ild_cdr.steer") else: print 'Detector Model for Mokka undefined for this energy' if detectormodel == 'ild_00': mo.setSteeringFile("ild_00.steer") if detectormodel == 'ILD_o1_v05': mo.setSteeringFile("bbudsc_3evt.steer") ##Simulation DDSim dd = DDSim() dd.setVersion("testVersion") dd.setNbEvts(10) # if energy in [500., 420., 375., 350., 250.,3000., 1400.]: # mo.setSteeringFile("dssimsteering.py") # else: # print 'SteeringFile Model for DDSim undefined for this energy' dd.setDetectorModel(detectormodel) ##Simulation SID slic = SLIC() slic.setVersion('v2r9p8') slic.setSteeringFile('defaultClicCrossingAngle.mac') slic.setDetectorModel('clic_sid_cdr') ##Split
def test_setDetectorModel1( self ): """test DDSIm setDetectorModel part of software.................................................""" detModel = "CLIC_o2_v03" ddsim = DDSim() ddsim.setDetectorModel( detModel ) self.assertEqual( ddsim.detectorModel, detModel )
job.setName(jobname) job.setJobGroup(jobGrName) job.setILDConfig(ILDConfigVer) job.setCPUTime(86400) job.setInputSandbox(["runSimSplit_any_Tmp.py"]) job.setOutputSandbox(["*.log","*.sh","*.py "]) #job.setOutputData(lcoutputSIM,OutputPath="MyTest/sim1",OutputSE="IN2P3-SRM") job.setOutputData( SIMoutput,"MyProd_" + ILDConfigVer + "/E250-TDR_ws/" + chann + "/" +ireq+ "/sim","IN2P3-SRM") #job.setDestinationCE('lyogrid07.in2p3.fr') job.dontPromptMe() job.setBannedSites(['LCG.Tau.il']) #job.setBannedSites(['LCG.IN2P3-CC.fr','LCG.DESYZN.de','LCG.DESY-HH.de','LCG.KEK.jp','OSG.UConn.us','LCG.Cracow.pl','OSG.MIT.us','LCG.Glasgow.uk','OSG.CIT.us','OSG.BNL.us','LCG.Brunel.uk','LCG.RAL-LCG2.uk','LCG.Oxford.uk','OSG.UCSDT2.us']) sim = DDSim() sim.setVersion(ILCSoftVer) sim.setDetectorModel(detModelSim) sim.setInputFile(lcinputSIM) sim.setSteeringFile("ddsim_steer.py") sim.setNumberOfEvents(evtsPrun) sim.setEnergy(energy) sim.setOutputFile(lcoutputSIM) #sim.setRandomSeed(RandSeed) sim.setStartFrom(evtStart) simres = job.append(sim) if not simres['OK']: print simres['Not ok appending ddsim to job'] quit()
def subDDSim(clip1): # Decide parameters for a job outputSE = "KEK-SRM" isLocal = clip1.isLocal nbevts = 0 if clip1.numberOfEvents == 0 else clip1.numberOfEvents #print('inside subddsim(): nbevts ', nbevts) outputFile = "" if clip1.outputFile == "" else clip1.outputFile #print('inside subddsim outfile ', outputFile) outputDir = clip1.outputDir #print('inside subddsim outdir ', outputDir) inputFile = clip1.inputFile #print('inside subddsim inputFile ', inputFile) if inputFile == "": gLogger.error("Input file for ddsim is not given.") exit(-1) # Create DIRAC objects for job submission dIlc = DiracILC() job = UserJob() job.setJobGroup("myddsimjob") job.setName("myddsim") job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) job.setILDConfig("v02-00-02") # job.setInputSandbox(["a6-parameters.sin", "P2f_qqbar.sin"]) # job.setDestination(["LCG.KEK.jp", "LCG.DESY-HH.de"]) # job submission destination job.setBannedSites(["LCG.UKI-SOUTHGRID-RALPP.uk" ]) # a list of sites not to submit job # job.setCPUTime( cputime_limit_in_seconds_by_dirac_units ) ddsim = DDSim() ddsim.setVersion("ILCSoft-02-00-02_gcc49") ddsim.setDetectorModel("ILD_l5_v05") ddsim.setInputFile(inputFile) ddsim.setNumberOfEvents(nbevts) extraCLIArguments = " --steeringFile ddsim_steer_July26.py" extraCLIArguments += " --outputFile %s " % outputFile extraCLIArguments += " --vertexSigma 0.0 0.0 0.1968 0.0 --vertexOffset 0.0 0.0 0.0 0.0 " ddsim.setExtraCLIArguments(extraCLIArguments) return ddsim
def test_setDetectorModel2(self): """test DDSIm setDetectorModel part of software failure.........................................""" detModel = "CLIC_o2_v03" ddsim = DDSim() res = ddsim.setDetectorModel(detModel) self.assertEqual(res['Message'], "No known models")
def test_setStartFrom1(self): """test DDSIm setStartFrom 1....................................................................""" ddsim = DDSim() ddsim.setStartFrom("Arg") self.assertTrue(ddsim._errorDict)
def test_setStartFrom2(self): """test DDSIm setStartFrom 2....................................................................""" ddsim = DDSim() ddsim.setStartFrom(42) self.assertEqual(ddsim.startFrom, 42)
def test_getKnownDetModels1( self ): """test getKnownDetectorModels failure no version...............................................""" ddsim = DDSim() ret = ddsim.getKnownDetectorModels() self.assertFalse( ret['OK'] ) self.assertEqual( "No software version defined", ret['Message'] )
def test_setDetectorModel2( self ): """test DDSIm setDetectorModel part of software failure.........................................""" detModel = "CLIC_o2_v03" ddsim = DDSim() res = ddsim.setDetectorModel( detModel ) self.assertEqual( res['Message'], "No known models" )
def subDDSim(): # Decide parameters for a job outputSE = "KEK-SRM" outputSE = "KEK-DISK" isLocal = _clip.isLocal nbevts = 10 if _clip.numberOfEvents == 0 else _clip.numberOfEvents outputFile = "ddsim_example.slcio" if _clip.outputFile == "" else _clip.outputFile outputDir = _clip.outputDir inputFile = _clip.inputFile if inputFile == "": gLogger.error("Input file for ddsim does not given.") exit(-1) # Create DIRAC objects for job submission dIlc = DiracILC() job = UserJob() job.setJobGroup("myddsimjob") job.setName("myddsim") job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) job.setILDConfig("v02-00-02") # job.setInputSandbox(["a6-parameters.sin", "P2f_qqbar.sin"]) # job.setDestination(["LCG.KEK.jp", "LCG.DESY-HH.de"]) # job submission destination job.setBannedSites(["LCG.UKI-SOUTHGRID-RALPP.uk" ]) # a list of sites not to submit job # job.setCPUTime( cputime_limit_in_seconds_by_dirac_units ) ddsim = DDSim() ddsim.setVersion("ILCSoft-02-00-02_gcc49") ddsim.setDetectorModel("ILD_l5_v02") ddsim.setInputFile(inputFile) ddsim.setNumberOfEvents(nbevts) extraCLIArguments = " --steeringFile ddsim_steer.py " extraCLIArguments += " --outputFile %s " % outputFile extraCLIArguments += " --vertexSigma 0.0 0.0 0.1968 0.0 --vertexOffset 0.0 0.0 0.0 0.0 " ddsim.setExtraCLIArguments(extraCLIArguments) # ddsim.setRandomSeed(1234565) # ddsim.setStartFrom(20) # Number of events to skip before starting ddsim job.append(ddsim) if outputDir != "": job.setOutputData([outputFile], OutputPath=outputDir, OutputSE=outputSE) if isLocal: job.submit(dIlc, mode="local") else: job.submit(dIlc)
def test_setStartFrom1( self ): """test DDSIm setStartFrom 1....................................................................""" ddsim = DDSim() ddsim.setStartFrom( "Arg") self.assertTrue( ddsim._errorDict )
def test_setStartFrom2( self ): """test DDSIm setStartFrom 2....................................................................""" ddsim = DDSim() ddsim.setStartFrom( 42 ) self.assertEqual( ddsim.startFrom, 42 )
stdhepsplit = StdHepSplit() stdhepsplit.setVersion("V2") stdhepsplit.setNumberOfEventsPerFile(nbevtsperfilestdhep) ##Simulation ILD mo = Mokka() mo.setVersion(MokkaVer) ###SET HERE YOUR MOKKA VERSION, the software will come from the ILDConfig mo.setDetectorModel(detectorModel) mo.setSteeringFile("bbudsc_3evt.steer") ### Do not include '.tgz' mo.setDbSlice(dbslice) ##Simulation ILD ddsim = None if UseDD4hepGeometry: ddsim = DDSim() ddsim.setVersion(DDSimVer) ###SET HERE YOUR MOKKA VERSION, the software will come from the ILDConfig ddsim.setDetectorModel(detectorModel) ddsim.setSteeringFile("ddsim_steer.py") ##Split split = SLCIOSplit() split.setNumberOfEventsPerFile(nbevtsperfile) ##Define the overlay overlay = OverlayInput() overlay.setMachine("ilc_dbd") #Don't touch, this is how the system knows what files to get overlay.setEnergy(energy) #Don't touch, this is how the system knows what files to get overlay.setDetectorModel(detectorModel) #Don't touch, this is how the system knows what files to get if energy==500.: #here you chose the overlay parameters as this determines how many files you need
def test_getKnownDetModels1(self): """test getKnownDetectorModels failure no version...............................................""" ddsim = DDSim() ret = ddsim.getKnownDetectorModels() self.assertFalse(ret['OK']) self.assertEqual("No software version defined", ret['Message'])
stdhepsplit = StdHepSplit() stdhepsplit.setVersion("V2") stdhepsplit.setNumberOfEventsPerFile(nbevtsperfilestdhep) ##Simulation ILD mo = Mokka() mo.setVersion(MokkaVer) ###SET HERE YOUR MOKKA VERSION, the software will come from the ILDConfig mo.setDetectorModel(detectorModel) mo.setSteeringFile("bbudsc_3evt.steer") ### Do not include '.tgz' mo.setDbSlice(dbslice) ##Simulation ILD ddsim = None if UseDD4hepGeometry: ddsim = DDSim() ddsim.setVersion(DDSimVer) ###SET HERE YOUR MOKKA VERSION, the software will come from the ILDConfig ddsim.setDetectorModel(detectorModel) ddsim.setSteeringFile("ddsim_steer.py") ##Split split = SLCIOSplit() split.setNumberOfEventsPerFile(nbevtsperfile) ##Define the overlay overlay = OverlayInput() overlay.setMachine("ilc_dbd") #Don't touch, this is how the system knows what files to get overlay.setEnergy(energy) #Don't touch, this is how the system knows what files to get overlay.setDetectorModel(detectorModel) #Don't touch, this is how the system knows what files to get if energy==500.: #here you chose the overlay parameters as this determines how many files you need
def setUp(self): """set up the objects""" self.dds = DDSim({})
job = UserJob() #use UserJob unless recommended differently job.setName(nameJob) job.setJobGroup(nameJobGroup) job.setCPUTime(86400) job.setBannedSites(['LCG.UKI-LT2-IC-HEP.uk','LCG.KEK.jp','LCG.IN2P3-CC.fr','LCG.Tau.il','Weizmann.il','LCG.Weizmann.il','OSG.MIT.us','OSG.FNAL_FERMIGRID.us','OSG.GridUNESP_CENTRAL.br','OSG.SPRACE.br']) job.setInputSandbox([nameSteeringMarlin,'LFN:/ilc/user/o/oviazlo/FCCee_o5/ilcsoft_2017-06-21/lcgeo_28_06_2017_v3.tgz',detectorModel,'LFN:/ilc/user/o/oviazlo/PandoraSettings.tar.gz','LFN:/ilc/user/o/oviazlo/FCCee_o5/marlin_lib_simHits_v3.tgz']) job.setOutputSandbox(["*.log"]) #files that should be brought back when retrieving the job outputs job.setOutputData([rootFile],nameDir,"CERN-DST-EOS") ##################################################################### ##################################################################### #ddsim ddsim = DDSim() ddsim.setVersion(ddsimVersion) ddsim.setDetectorModel(detectorModel) ddsim.setOutputFile(outputFile) ddsim.setSteeringFile("/afs/cern.ch/work/v/viazlo/gridSubmission/FCCee_o5/files/clic_steer.py") ddsim.setNumberOfEvents(nEvts) res = job.append(ddsim) if not res['OK']: print res['Message'] sys.exit(2) ##################################################################### # #####################################################################
def test_setDetectorModel1(self): """test DDSIm setDetectorModel part of software.................................................""" detModel = "CLIC_o2_v03" ddsim = DDSim() ddsim.setDetectorModel(detModel) self.assertEqual(ddsim.detectorModel, detModel)
class DDSimTestCase(unittest.TestCase): """ Base class for the DDSim test cases """ def setUp(self): """set up the objects""" self.dds = DDSim({}) def test_setrandomseed(self): self.assertFalse(self.dds._errorDict) self.dds.setRandomSeed(89421) self.assertFalse(self.dds._errorDict) assertEqualsImproved(self.dds.randomSeed, 89421, self) def test_setrandomseed_fails(self): self.assertFalse(self.dds._errorDict) self.dds.setRandomSeed(['abc']) self.assertIn('_checkArgs', self.dds._errorDict) def test_setstartfrom(self): self.assertFalse(self.dds._errorDict) self.dds.setStartFrom(89421) self.assertFalse(self.dds._errorDict) assertEqualsImproved(self.dds.startFrom, 89421, self) def test_setstartfrom_fails(self): self.assertFalse(self.dds._errorDict) self.dds.setStartFrom('adgiuj') self.assertIn('_checkArgs', self.dds._errorDict) def test_resolvelinkedparams(self): step_mock = Mock() input_mock = Mock() input_mock.getType.return_value = {'abc': False} self.dds._linkedidx = 3 self.dds._jobsteps = [None, None, None, input_mock] assertDiracSucceeds(self.dds._resolveLinkedStepParameters(step_mock), self) step_mock.setLink.assert_called_once_with('InputFile', {'abc': False}, 'OutputFile') def test_resolvelinkedparams_noinputstep(self): self.dds._linkedidx = None self.dds._inputappstep = [] assertDiracSucceeds(self.dds._resolveLinkedStepParameters(None), self) def test_checkworkflow_app_missing(self): self.dds._inputapp = [ 'some_depdency', 'unavailable_dependency_fail_on_this' ] self.dds._jobapps = ['myjobapp_1', 'some_dependency'] assertDiracFailsWith(self.dds._checkWorkflowConsistency(), 'job order not correct', self) def test_checkworkflow_empty(self): self.dds._inputapp = [] self.dds._jobapps = [] assertDiracSucceeds(self.dds._checkWorkflowConsistency(), self) def test_checkworkflow_success(self): self.dds._inputapp = [ 'some_dependency', 'other_dependencies', 'many_more' ] self.dds._jobapps = [ 'ignore_me', 'many_more', 'some_dependency', 'other_dependencies' ] assertDiracSucceeds(self.dds._checkWorkflowConsistency(), self) def test_userjobmodules(self): module_mock = Mock() assertDiracSucceeds(self.dds._userjobmodules(module_mock), self) def test_prodjobmodules(self): module_mock = Mock() assertDiracSucceeds(self.dds._prodjobmodules(module_mock), self) def test_userjobmodules_fails(self): with patch('%s._setUserJobFinalization' % MODULE_NAME, new=Mock(return_value=S_OK('something'))),\ patch('%s._setApplicationModuleAndParameters' % MODULE_NAME, new=Mock(return_value=S_ERROR('some_test_err'))): assertDiracFailsWith(self.dds._userjobmodules(None), 'userjobmodules failed', self) def test_prodjobmodules_fails(self): with patch('%s._setApplicationModuleAndParameters' % MODULE_NAME, new=Mock(return_value=S_OK('something'))), \ patch('%s._setOutputComputeDataList' % MODULE_NAME, new=Mock(return_value=S_ERROR('some_other_test_err'))): assertDiracFailsWith(self.dds._prodjobmodules(None), 'prodjobmodules failed', self) def test_checkconsistency(self): self.dds.version = '134' self.dds.detectorModel = 'mymodel.det' self.dds.outputFile = 'myoutput.file' self.dds._jobtype = 'User' assertDiracSucceeds(self.dds._checkConsistency(Mock()), self) self.assertNotIn( { 'outputFile': '@{OutputFile}', 'outputPath': '@{OutputPath}', 'outputDataSE': '@{OutputSE}' }, self.dds._listofoutput) self.assertNotIn('nbevts', self.dds.prodparameters) self.assertNotIn('Process', self.dds.prodparameters) def test_checkconsistency_nodetectormodel(self): self.dds.version = 123 self.dds.steeringFile = None self.dds.detectorModel = None assertDiracFailsWith(self.dds._checkConsistency(Mock()), 'no detectormodel set', self) def test_checkconsistency_noversion(self): self.dds.version = None assertDiracFailsWith(self.dds._checkConsistency(Mock()), 'no version found', self) def test_checkconsistency_existsfails(self): self.dds.version = '134' self.dds.steeringFile = 'mysteer.file' with patch('os.path.exists', new=Mock(return_value=False)), \ patch.object(inspect.getmodule(DDSim), 'Exists', new=Mock(return_value=S_ERROR('testerr_exists_mock'))): assertDiracFailsWith(self.dds._checkConsistency(Mock()), 'testerr_exists_mock', self) def test_checkconsistency_userjob(self): self.dds.version = '134' self.dds.steeringFile = 'mysteer.file' self.dds._jobtype = 'notUser' self.dds.detectorModel = 'myDetectorv200' with patch('os.path.exists', new=Mock(return_value=True)), \ patch.object(inspect.getmodule(DDSim), 'Exists', new=Mock(return_value=S_ERROR('testerr_exists_mock'))): assertDiracSucceeds(self.dds._checkConsistency(Mock()), self) self.assertIn( { 'outputFile': '@{OutputFile}', 'outputPath': '@{OutputPath}', 'outputDataSE': '@{OutputSE}' }, self.dds._listofoutput) for keyword in ['detectorType', 'slic_detectormodel']: self.assertIn(keyword, self.dds.prodparameters) def test_checkconsistency_userjob_notdetmodel(self): self.dds.version = '134' self.dds.steeringFile = 'mysteer.file' self.dds._jobtype = 'notUser' self.dds.detectorModel = True self.dds.setStartFrom(148) with patch('os.path.exists', new=Mock(return_value=False)), \ patch.object(inspect.getmodule(DDSim), 'Exists', new=Mock(return_value=S_OK())): assertDiracSucceeds(self.dds._checkConsistency(Mock()), self) self.assertIn( { 'outputFile': '@{OutputFile}', 'outputPath': '@{OutputPath}', 'outputDataSE': '@{OutputSE}' }, self.dds._listofoutput) for keyword in ['detectorType', 'slic_detectormodel']: self.assertIn(keyword, self.dds.prodparameters)
def main(argv): # Input arguments ildconfig_version = "$ILDCONFIGVER" ilcsoft_version = "$ILCSOFTVER" evts_per_run = $EVTSPERRUN detector_model = "$DETECTOR" sim_input = "$SIMINPUT" process_name = "$PROCESS" index = $IND sim_input = diracpath_from_pnfspath( sim_input ) sim_detector_model = detector_model_wo_option( detector_model ) job_group = ilcsoft_version + "_" + ildconfig_version + "_" + process_name + "_" + detector_model dirac = DiracILC(True,job_group+".rep") # outputs to be saved onto grid SE RECoutput = [] # DDSim evtStart = (index-1)*evts_per_run evtEnd = index*evts_per_run - 1 RandSeed = random.randrange(11623, 99999) lcinputSIM = "LFN:" + sim_input lcoutputSIM = ilcsoft_version + ".ILDConfig_" + ildconfig_version + ".E1000." + process_name + ".eLpR.evt%s-%s_SIM.slcio"%(str(evtStart),(str)(evtEnd)) sim = DDSim() sim.setVersion(ilcsoft_version) sim.setDetectorModel(sim_detector_model) sim.setInputFile(lcinputSIM) sim.setSteeringFile("ddsim_steer.py") sim.setNumberOfEvents(evts_per_run) sim.setRandomSeed(RandSeed) sim.setEnergy(1000) sim.setStartFrom(evtStart) sim.setOutputFile(lcoutputSIM) # Marlin lcoutputDST = ilcsoft_version + ".ILDConfig_" + ildconfig_version + ".E1000." + process_name + ".eLpR.evt%s-%s_DST.slcio"%(str(evtStart),(str)(evtEnd)) ma = Marlin() ma.setVersion(ilcsoft_version) ma.setDetectorModel(detector_model) ma.setSteeringFile("MarlinStdReco.xml") ma.setExtraCLIArguments( "--constant.lcgeo_DIR=$lcgeo_DIR --constant.DetectorModel={} --global.MaxRecordNumber=0".format(detector_model) ) ma.setLogFile("marlin.log") ma.getInputFromApp(sim) ma.setEnergy(1000) ma.setOutputDstFile(lcoutputDST) RECoutput.append(lcoutputDST) # ILCDirac user job job = UserJob() job.setName("user_sim_reco") job.setJobGroup(job_group) job.setILDConfig(ildconfig_version) job.setCPUTime(86400) tmp_file_name = process_name + "_sim_reco_job_tmp.py" job.setInputSandbox([tmp_file_name]) job.setOutputSandbox(["*.log","MarlinStdRecoParsed.xml","marlin*.xml","*.py "]) job.dontPromptMe() job.setBannedSites(['LCG.IN2P3-CC.fr','OSG.UConn.us','LCG.Cracow.pl','OSG.MIT.us','LCG.Glasgow.uk','OSG.CIT.us','OSG.BNL.us','LCG.Brunel.uk','LCG.RAL-LCG2.uk','LCG.Oxford.uk','OSG.UCSDT2.us']) # run simulation job simres = job.append(sim) if not simres['OK']: print simres['Not ok appending ddsim to job'] quit() # run Malrin reco jobs mares = job.append(ma) if not mares['OK']: print mares['Not ok appending Marlin to job'] quit() job.setOutputData(RECoutput,"ILDPerformance/WWZZSeparation/{}_ILDConfig_{}_{}".format(ilcsoft_version,ildconfig_version,detector_model),"DESY-SRM") print RECoutput submit_output = job.submit(dirac) print submit_output