Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump post processed XML file #22

Merged
merged 9 commits into from
Nov 2, 2017
Merged

Dump post processed XML file #22

merged 9 commits into from
Nov 2, 2017

Conversation

rete
Copy link
Contributor

@rete rete commented Oct 30, 2017

BEGINRELEASENOTES

  • Added write() method to XMLParser (resp. Parser) to write the loaded xml tree (resp. same file) in a new file.
  • Many methods adapted in XMLParser to make parameter/constant replacements persistent in the XML tree
  • New global parameter "OutputSteeringFile" introduced to write down a new steering file after processing
  • Added command line option -n for a Marlin dry-run
  • Example :
# take the output file name from steering file and run Marlin as usual
Marlin steeringFile.xml 
# same but exit after writing the output steering file
Marlin -n steeringFile.xml 
# change the output file name
Marlin steeringFile.xml --global.OutputSteeringFile=MyParsedSteeringFile.xml 

ENDRELEASENOTES

@andresailer
Copy link
Contributor

I think it would be better to allow the writing of the xml in addition to running Marlin.
If the invocation to create the PostParsed.xml file is an extra step things become more complicated in iLCDirac, because Marlin has to be called once more, but only for certain versions. If -p is just another flag to the usual Marlin run it can be added by the user.
I.e.

Marlin -pPostParsed.xml PreParsed.xml

Would run PreParsed.xml and also write out the PostParsed.xml file.
And then add a "dry-run" option
Marlin -n -pPostParsed.xml PreParsed.xml

that only produces PostParsed.xml.

…ew file. Many methods adapted to make parameter/constant replacement persistent in the XML tree
@gaede
Copy link
Contributor

gaede commented Oct 30, 2017

I believe what we discussed is:

  • introduce an optional global paramter (e.g. global.ParsedXMLFile )
  • if this parameter is not empty write out the parsed XML file
  • introduce a Marlin option to stop the processing after this parsing step
    • here we discussed both options '-p' for parse-only or '-n' for dry-run (either one would be fine with me)

@rete
Copy link
Contributor Author

rete commented Oct 30, 2017

I added a dry-run option -n
Summary :
Printout the marlin XML and run Marlin :

Marlin -p postSteering.xml steering.xml

Printout the marlin XML and exit :

Marlin -n postSteering.xml steering.xml

@gaede : Is this OK for you in this way ? I could change it to put this functionnality in a xml parameter in the global section.

@rete
Copy link
Contributor Author

rete commented Nov 1, 2017

The output steering file name is no longer taken from command line args but from the input steering file itself by the key "OutputSteeringFile". This has the following consequences :

  • The write(fname) function in XMLParser was moved in the top-level class IParser and thus the method is also implemented in the Parser class (.steer files) as a raw copy paste of the input steering file
  • The output steering file name can be specified by command line parameter using the usual parameter replacement mechanism

I added this key (OutputSteeringFile) to the steering file of the ctest that is testing the include mechanism. It works as expected.

Example :

# take the output file name from steering file and run Marlin as usual
Marlin steeringFile.xml 
# same but exit after writing the output steering file
Marlin -n steeringFile.xml 
# change the output file name
Marlin steeringFile.xml --global.OutputSteeringFile=myParsedSteeringFile.xml 

Copy link
Contributor

@gaede gaede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put your documentation/example in RELEASENOTES.

@rete
Copy link
Contributor Author

rete commented Nov 1, 2017

I'm done with release notes

@rete
Copy link
Contributor Author

rete commented Nov 2, 2017

Do not merge yet. There are missing features in this PR that I discussed with Frank.

@rete
Copy link
Contributor Author

rete commented Nov 2, 2017

I added :

  • protection against nested include, by throwing exception if one is detected
  • removed constant evaluation replacement in the XML tree for constants and processor parameters

For this latest point, it means that command line parameter are replaced in the constant element in the XML tree but not constant evaluation. As a consequence, the output parsed file will contain runtime argument from the command line while running in dry-run mode but will re-evaluate again the constants and processor parameters in the next parsing.

I don't know if I'm clear ...

@gaede gaede merged commit f09ee7f into iLCSoft:master Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants