Closed jonzarling closed 4 years ago
MakeMC does not read the MC config file.....you are referring to the parsing done in gluex_MC. There are already many safeguards in place that aid in the parsing; there are of course a lot of variables and a lot of variables those could take in so fool-proof is nearly impossible. For every line that isn't empty or not completely commented out it begins its parsing by taking the text before the first '#'. If there is no '#' it gets the whole line. It then breaks the line into two pieces, the first is everything to the left of the first '=' and the second is the rest. It then cleans the pieces by removing whitespace and new line characters. Then is does variable specific checks.
for the generator config issue: there is a wrinkle in that the GENERATOR_CONFIG file is not always needed, writing the check to tell when it is needed and then requiring it is doable but would require someone to maintain a hard coded list of acceptable generators. And what then if someone is using MCwrapper to develop a new generator? Or where the generator itself needs no configuration file (they exist)? There needs to be some trust that what they put in works (here in lies the problem).
On the whole I could not do key word searching as I tend to, and know others do too, work with config files that may have several copies of some keywords.
I have also done some precursory searches for some python config file modules....similar to argeparse. But everything I found (I should do a better search) does not do a great job handling the variable specific things (e.g. the delimiter is an '=' but the value can also have an '=')
assuming you got to here....the variation is an oversight. I'll throw an exception if if finds VARIATION and the value is ""....others will likely need handling one at a time
fixed. These will be dealt with on a case by case basis
Creating a github issue as recommended by Peter Pauli.
The switch statement in MakeMC.(c)sh is very sensitive to mistakes and omissions in the configuration file. For instance, if one just uncomments the VARIATION line in the example configuration, the parsing interprets this as two separate things, screwing up the slew of setenv commands. This can be a little hard to diagnose if one hasn't encountered a similar issue in the past. Another mistake I've made is to not comment/remove the text on the GENERATOR_CONFIG line. Similarly, since this has a few space separated words, they also screw up the order when passing things to the big switch statement.
While the likelihood of running into this could probably be reduced by cleaning up the MC.config text, I think a better solution is to add some additional checking in the MakeMC.(c)sh or gluex_MC.py scripts to avoid this type of issue. There are probably a few ways to address it, but it doesn't seem like it should be particularly difficult to come up with some improvements there.
For the examples above, you can go to /w/halld-scifs17exp/home/jzarling/MCGEN/configs/switch_statement_example on the farm and run the configs there. There is a working one, one with the VARIATION line issue above, and one with the GENERATOR CONFIG line issue as well. The command
$MCWRAPPER_CENTRAL/gluex_MC.py MC.config 30300 10 batch=0
should do the trick.