The Gaudi Framework  master (37c0b60a)
concurrentRun.cpp File Reference
#include <Gaudi/Property.h>
#include <GaudiKernel/Bootstrap.h>
#include <GaudiKernel/IAppMgrUI.h>
#include <GaudiKernel/IProperty.h>
#include <GaudiKernel/ISvcLocator.h>
#include <GaudiKernel/SmartIF.h>
#include <iostream>
#include <string>
#include <boost/program_options.hpp>
Include dependency graph for concurrentRun.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file concurrentRun.cpp.

26  {
27  // Declare the command line options and read them in
28  options_description desc( "Allowed options" );
29  desc.add_options()( "help,h", "produce help message" )( "config", value<std::string>(),
30  "comma separated list of python configuration files" )(
31  "post-option", value<std::string>(), "python command to be run after ConfigurableUser has been applied" )(
32  "param", value<std::vector<std::string>>(), "parameters to the configuration file, multiple can be given" );
33  positional_options_description p;
34  p.add( "config", 1 );
35  variables_map vm;
36  try {
37  store( command_line_parser( argc, argv ).options( desc ).positional( p ).run(), vm );
38  } catch ( boost::exception_detail::clone_impl<
39  boost::exception_detail::error_info_injector<boost::program_options::unknown_option>>& ) {
40  std::cerr << "Unknown option(s) detected." << std::endl << "Usage:" << std::endl << desc << std::endl;
41  return ( 1 );
42  }
43  notify( vm );
44 
45  std::string fileName;
46  // handle the retrieved options
47  if ( vm.count( "help" ) or vm.count( "h" ) ) {
48  std::cout << desc << std::endl;
49  return 1;
50  }
51  if ( !vm.count( "config" ) ) {
52  std::cout << "Please specify a config file" << std::endl;
53  return 1;
54  } else {
55  fileName = vm["config"].as<std::string>();
56  }
57 
58  std::stringstream params;
59  if ( 0 != vm.count( "param" ) ) {
60  std::vector<std::string> vParams = vm["param"].as<std::vector<std::string>>();
61  std::cout << "Configuration parameters are:" << std::endl;
62  for ( const std::string& s : vParams ) {
63  params << s << "\n";
64  std::cout << "\t" << s << std::endl;
65  }
66  }
67 
68  std::string postAction;
69  if ( 0 != vm.count( "post-option" ) ) { postAction = vm["post-option"].as<std::string>(); }
70  // end of options handling
71 
73  SmartIF<IProperty> propMgr( iface );
74  SmartIF<IAppMgrUI> appUI( iface );
75  propMgr->setProperty( "JobOptionsType", "PYTHON" ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
76  propMgr->setProperty( "JobOptionsPath", fileName ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
77  propMgr->setProperty( "JobOptionsPreAction", params.str() ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
78  propMgr->setProperty( "JobOptionsPostAction", postAction )
79  .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); // TODO: grep this from command line
80  return appUI->run().getCode();
81 }
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)
std::string
STL class.
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:173
gaudirun.s
string s
Definition: gaudirun.py:346
std::vector< std::string >
std::stringstream
STL class.
std::cerr
SmartIF< IProperty >
std::endl
T endl(T... args)
IInterface
Definition: IInterface.h:239
std::stringstream::str
T str(T... args)
gaudirun.options
options
Definition: gaudirun.py:313
gaudirun.argv
list argv
Definition: gaudirun.py:327