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

Need options to dump out final configuration/json used in WireCell::Main #277

Open
HaiwangYu opened this issue Feb 18, 2024 · 1 comment
Assignees

Comments

@HaiwangYu
Copy link
Member

With the many layered fcl and wire-cell includes, it becomes harder to determine the actual parameters used in WireCell::Main. E.g., @Laura Paulucci raised a question how to determine the nticks parameter value actually used. I think we probably need an option to dump the final configuration/json for easy debugging without checking all layers of includes. Meaning some integration of wcsonnet into WireCell::Main is probably useful. @brettviren what do you think?

Notes:
https://github.com/LArSoft/larwirecell/blob/develop/larwirecell/Tools/WCLS_tool.cc#L175
https://github.com/WireCell/wire-cell-toolkit/blob/master/apps/src/Main.cxx#L260
https://github.com/WireCell/wire-cell-toolkit/blob/master/apps/apps/wcsonnet.cxx#L87-L92

@brettviren
Copy link
Member

Hi @HaiwangYu

Yes, I think this is a worthwhile thing to address. DUNE's nascent "framework requirements" includes the need to be able to persist the configuration used by a job so it would also be useful there. Though, how exactly that persistence is meant to work is not yet specified.

Today, using wcsonnet would be the quickest way to see the final WCT configuration object in all its glory. The only hassle is that one must supply values for the various std.extVar (such as passed from FHiCL) or TLAs such as passed on the wire-cell command line. The hassle can be reduced by passing bogus values as long as the user is sure these do not impact whatever chunk of config that is of interest.

Going forward, to allow some kind of "as-configured" dumper, Main is the right place to start. The Main object uses a ConfigManager to collect all the configuration files (WCT actually can accept multiple, though we usually stick to just one). It's all() method returns the full object:

https://github.com/WireCell/wire-cell-toolkit/blob/master/util/inc/WireCellUtil/ConfigManager.h#L37

That object can then be given to Persist::dump() a save a JSON representation of the configuration object to a file or Persist:dumps() send JSON to logging or some output stream.

https://github.com/WireCell/wire-cell-toolkit/blob/master/util/inc/WireCellUtil/Persist.h#L80

The question is then how/where best to trigger/produce a config dump. It is only Main that has access to the full configuration object so that's the likely candidate. However, if we (eg DUNE) wants config to turn into an art::Event record, that should/must be done by a DFP node component, but currently there is no way for such a component to get access to the full config.

For now, I suggest we add methods and option to Main and wire-cell (and thus also available to the WC/LS interface) which allows something like this (for CLI example):

wire-cell --dump-configuration [target] [...usual arguments...]

Where target would be interpreted as:

  • stderr / stdout dumps to these streams via raw cerr/cout
  • info / debug dumps to these log levels
  • anything else is interpreted as a name of a file to create and write (not append)

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

No branches or pull requests

2 participants