| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
concurrentRun.cpp File Reference
`#include <iostream>`
`#include <string>`
`#include "GaudiKernel/Bootstrap.h"`
`#include "GaudiKernel/IAppMgrUI.h"`
`#include "GaudiKernel/IProperty.h"`
`#include "GaudiKernel/ISvcLocator.h"`
`#include "GaudiKernel/Property.h"`
`#include "GaudiKernel/SmartIF.h"`
`#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

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

Definition at line 16 of file concurrentRun.cpp.

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