The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
concurrentRun.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
Gaudi/Property.h
>
12
#include <
GaudiKernel/Bootstrap.h
>
13
#include <
GaudiKernel/IAppMgrUI.h
>
14
#include <
GaudiKernel/IProperty.h
>
15
#include <
GaudiKernel/ISvcLocator.h
>
16
#include <
GaudiKernel/SmartIF.h
>
17
#include <iostream>
18
#include <string>
19
20
// boost includes
21
#include <boost/program_options.hpp>
22
23
using namespace
boost::program_options;
24
25
//-----------------------------------------------------------------------------
26
int
main
(
int
argc,
char
** argv ) {
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
72
IInterface
* iface =
Gaudi::createApplicationMgr
();
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
}
main
int main()
Definition
Allocator.cpp:128
Bootstrap.h
Property.h
IAppMgrUI.h
IProperty.h
ISvcLocator.h
SmartIF.h
IInterface
Definition of the basic interface.
Definition
IInterface.h:225
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition
SmartIF.h:28
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr()
GaudiHive
src
bin
concurrentRun.cpp
Generated on
for The Gaudi Framework by
1.17.0