Skip to content

Commit

Permalink
Do not parse twice
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Jan 12, 2023
1 parent cbd7c8f commit 59b0c68
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions k4FWCore/scripts/k4run
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,9 @@ class LoadFromFile(argparse.Action):
proptype = type(propvalue[0])
propnargs = "+"

# add the argument twice, once as "--PodioOutput.filename"
# and once as "--filename.PodioOutput"
propName = conf.name() + '.' + prop
propNameReversed = prop + '.' + conf.name()
option_db[propName] = (conf, propName)
parser.add_argument( "--%s" % propName, "--%s" % propNameReversed, type=proptype, help=props[prop][1],
nargs=propnargs,
default=propvalue)
option_db[propName] = (conf, propName, propvalue)

if __name__ == "__main__":
# ensure that we (and the subprocesses) use the C standard localization
Expand Down Expand Up @@ -106,10 +101,6 @@ if __name__ == "__main__":
help="Start Gaudi in parallel mode using NCPUS processes. "
"0 => serial mode (default), -1 => use all CPUs")

# Once to parse the files and another time to have the new parameters
# in the namespace since parsing of the file happens when the namespace
# has already been filled
opts = parser.parse_args()
opts = parser.parse_args()

# print a doc line showing the configured algorithms
Expand All @@ -131,10 +122,9 @@ if __name__ == "__main__":
print(" %s (from %s)" % (item, cfgDb[item]["lib"]))
sys.exit()

opts_dict = vars(opts)
for optionName, propTuple in option_db.items():
logger.info("Option name: " + str(propTuple[1]) + " " + optionName + " " + str(opts_dict[optionName]))
propTuple[0].setProp(propTuple[1].rsplit(".",1)[1], opts_dict[optionName])
logger.info("Option name: " + str(propTuple[1]) + " " + optionName + " " + str(propTuple[2]))
propTuple[0].setProp(propTuple[1].rsplit(".",1)[1], propTuple[2])

if opts.verbose:
ApplicationMgr().OutputLevel = VERBOSE
Expand Down

0 comments on commit 59b0c68

Please sign in to comment.