Project

General

Profile

Feature #2456

fhicl feature for future

Added by Rob Kutschke over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Low
Category:
Infrastructure
Target version:
Start date:
02/06/2012
Due date:
09/30/2013
% Done:

100%

Estimated time:
16.00 h
Spent time:
Scope:
Internal
Experiment:
Mu2e
SSI Package:
fhicl-cpp
Duration: 603

Description

When writing the SeedService for Mu2e I encountered the following situation. Given an fhicl key, I sometimes expect the value to be an int and at other times to be a fhcil table. An example of the relevant fragment of a runtime configuration is

SeedService : {
a : 1
b : { b1 : 2 b2 : 3 }
}
where a and b are module labels and where b1 and b2 are instance names of random engines. The first form is used iff the module with label a uses exactly one random engine and it does not use an instance name for that engine; the second form is used for all other cases. When a module calls the service it will either provide an instance name, or not. Using that information the service can decide whether the fhicl value of the module label should be an int or a table. This works well.

The issue is that I would like to parse the configuration at startup time in order to check for a self consistent configuration. As best I can tell, I cannot do so using the available fhiclcpp calls. What I do now is to run the self consistency check every time that someone pokes the service, causing it to parse one more piece of the configuration. This is works for this particular use case - it has a trivial CPU usage and memory footprint and its costs are incurred only in the initialization phase of the job - there are no per event costs. So this is a low priority request.

In the long run I would like to be able to perform a self consistency check as soon as I get the parameter set. I can do so now only using try/catch blocks, which I prefer to avoid lest others take it as a recommendation for the more general case. If we extend the interace of fhiclcpp as follows, I can do my job: I would like to be able to ask fhiclcpp if the value of a specified key is a scalar, a list, or a table.

History

#1 Updated by Christopher Green about 7 years ago

  • Due date set to 09/30/2013
  • Category set to Infrastructure
  • Status changed from New to Accepted
  • Target version set to 1.09.00
  • Estimated time set to 16.00 h
  • Scope set to Internal
  • Experiment Mu2e added
  • SSI Package fhicl-cpp added

#2 Updated by Christopher Green over 6 years ago

  • Target version changed from 1.09.00 to 521

#3 Updated by Christopher Green about 6 years ago

  • Status changed from Accepted to Resolved
  • Assignee set to Christopher Green
  • Target version changed from 521 to 1.11.00
  • % Done changed from 0 to 100

fhicl::ParameterSet has new functions bool is_key_to_{table,sequence,atom}(std::string const & key) const which should do exactly what you need.

Implemented (with tests) with commit:a855fbc6436b1f52081d11333944a953bd2fc637 as it was needed for efficient implementation of other features.

#4 Updated by Christopher Green about 6 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF