17 parser = ArgumentParser(description=
'create gridpackage from job option')
18 parser.add_argument(
"jobOptionDir",type=str, nargs=
'+',help=
"Path to job option directory. If multiple are given only the calculation of MinEvents is performed for the additional setups (meant e.g. for different filters).")
19 parser.add_argument(
'-b',
'--batchSystem', type=str, dest=
'batchSystem', default=
'htcondor_lxplus', help=
'Batch system to use (default = %(default)s, alternatives: htcondor_naf, slurm_taurus, slurm_barnard, sge_grace)')
20 parser.add_argument(
'-c',
'--ecm', type=float, dest=
'ecm', nargs=
"+", default=[13.6], help=
'center of mass energy in TeV')
21 parser.add_argument(
'-o',
'--only', type=str, dest=
'performOnly', nargs=
"+", default=[
"all"], help=
'steps which can be performed, default:all, there are: getOpenLoops, createLibs, makelibs, integrate, makeTarball, evgen')
22 parser.add_argument(
'-n',
'--maxCores', type=int, dest=
'maxCores', default=
"100000", help=
'maximal number of cores for the integration')
23 parser.add_argument(
'-r',
'--RAM', type=int, dest=
'RAM', default=
"-1", help=
'reserved RAM in MB for the integration')
24 parser.add_argument(
'-l',
'--createLibsRAM', type=int, dest=
'createLibsRAM', default=
"2", help=
'reserved RAM in MB for createLibs, values 1 and 2 are translated into normal RAM usage and extended RAM usage respectively')
25 parser.add_argument(
'-m',
'--ncoresMakelibs', type=int, dest=
'ncoresMakelibs', default=
"4", help=
'maximal number of cores for Makelibs')
26 parser.add_argument(
'-s',
'--ncoresScons', type=int, dest=
'ncoresScons', default=
"4", help=
'maximal number of cores for OpenLoops installation')
27 parser.add_argument(
'-e',
'--nEvts', type=int, dest=
'nEvts', default=
"100", help=
'number of events which get generated in the test run')
28 parser.add_argument(
'-t',
'--tarballVersion', type=str, dest=
'tarballVersion', default=
"1", help=
'version of tarball on grid')
29 parser.add_argument(
'-p',
'--local-sherpa', dest=
'sherpaInstallPath', default=
None, help=
"Path to custom-built local Sherpa installation. If None, use cvmfs version.")
30 parser.add_argument(
'-v',
'--athenaVersion', type=str, dest=
'athenaVersion', default=
None, help=
'Overwrite Athena version to be used.')
31 parser.add_argument(
'--OLskipcvmfs', dest=
'OLskipcvmfs', default=
False, action=
'store_true', help=
"Skip precompiled OpenLoops libraries from cvmfs.")
32 parser.add_argument(
'--OLbranch', dest=
'OLbranch', type=str, default=
None, help=
"OpenLoops branch to use from https://gitlab.com/openloops/OpenLoops (e.g. OpenLoops-2.1.2 or public_beta)")
33 parser.add_argument(
'--OLprocessrepos', dest=
'OLprocessrepos', type=str, default=
"ATLAS,public_beta,public", help=
"OpenLoops process repositories to use with ./openloops libinstall")
34 parser.add_argument(
'-d',
'--dryRun', action=
'store_true', default=
False, dest=
'dryRun', help=
"Do not actually submit jobs to cluster but just print them.")
35 options = parser.parse_args()
38 options.batchSystemModule = importlib.import_module(
"Sherpa_i.sherpaTarCreator."+options.batchSystem)
40 for i
in range(len(options.jobOptionDir)):
41 if not os.path.isdir(options.jobOptionDir[i]):
42 print (
"ERROR: JO folder \"" + options.jobOptionDir[i] +
"\" not found.")
44 options.jobOptionDir[i] = os.path.abspath(options.jobOptionDir[i])
45 os.chdir(options.jobOptionDir[0])
47 if not options.athenaVersion:
48 if "stable" in os.environ[
'AtlasReleaseType']:
49 options.athenaVersion = os.environ[
'AtlasVersion']+
","+os.environ[
'AtlasProject']
50 elif "nightly" in os.environ[
'AtlasReleaseType']:
51 options.athenaVersion = os.environ[
'AtlasBuildBranch']+
","+os.environ[
'AtlasProject']+
",r"+os.environ[
'AtlasBuildStamp']
53 print (
"ERROR: Did not find Athena environment. Did you run asetup?")
58 readjo.readJO(options)
60 from .
import jobDefinitions
62 for jodir
in options.jobOptionDir:
63 if not os.path.isdir(jodir):
64 print (
"ERROR: JO folder not found.")
66 for ecm
in options.ecm:
67 folder = jodir+
"/ecm"+(
'{0:g}'.
format(ecm)).
replace(
".",
"p")+
"TeV"
69 if not os.path.isdir(folder):
72 if not os.path.islink(os.path.join(folder,
"Process")):
73 os.symlink(os.path.join(
"..",
"Process"), os.path.join(folder,
"Process"))
75 for f
in options.Sherpa_i.ExtraFiles:
76 fi = os.path.basename(os.path.normpath(os.path.abspath(f)))
77 if not os.path.exists(fi):
78 print (
"ERROR: The extraFile '"+f+
"' does not exist, but is required according to the joboption file")
80 if not os.path.islink(os.path.join(folder,fi)):
81 os.symlink(os.path.join(options.jobOptionDir[0],fi), os.path.join(folder,fi))
83 if not os.path.islink(os.path.join(folder,
"libSherpa_iPlugin.so")):
84 if options.Sherpa_i.PluginCode !=
"":
85 os.symlink(os.path.join(options.jobOptionDir[0],
"libSherpa_iPlugin.so"), os.path.join(folder,
"libSherpa_iPlugin.so"))
88 getOpenLoopsJob = jobDefinitions.mkGetOpenLoopsJob(options)
90 prevJob = getOpenLoopsJob
92 createLibsJob = jobDefinitions.mkCreateLibsJob(options, prevJob)
94 prevJob = createLibsJob
96 makelibsJob = jobDefinitions.mkMakelibsJob(options, prevJob)
100 for ecm
in options.ecm:
103 integrationJob = jobDefinitions.mkIntegrateJob(options, ecm, ecmPrevJob)
105 ecmPrevJob = integrationJob
107 tarballmakerJob = jobDefinitions.mkTarballmakerJob(options, ecm, ecmPrevJob)
109 ecmPrevJob = tarballmakerJob
111 for jodir
in options.jobOptionDir:
112 jobDefinitions.mkEvntGenTestJob(options, ecm, jodir, ecmPrevJob)
114 options.batchSystemModule.finalizeJobs(options.dryRun)