12 #include "artdaq-core/Data/Fragment.hh"
13 #include "artdaq-core/Utilities/ExceptionHandler.hh"
15 #include "artdaq/DAQdata/Globals.hh"
16 #include "artdaq-utilities/Plugins/MetricManager.hh"
17 #include "cetlib/container_algorithms.h"
18 #include "cetlib/filepath_maker.h"
19 #include "fhiclcpp/ParameterSet.h"
20 #include "fhiclcpp/make_ParameterSet.h"
21 #include "boost/program_options.hpp"
27 #include <artdaq/Application/AggregatorApp.hh>
28 #include <artdaq/ExternalComms/xmlrpc_commander.hh>
29 #include <artdaq/BuildInfo/GetPackageBuildInfo.hh>
31 int main(
int argc,
char * argv[])
33 std::ostringstream descstr;
35 <<
" <-p <port-number>> <-r <rank>> [-n <name>] [-c <config-file>]";
36 boost::program_options::options_description desc(descstr.str());
38 (
"config,c", boost::program_options::value<std::string>(),
"Configuration file.")
39 (
"rank,r", boost::program_options::value<int>(),
"Process Rank")
40 (
"port,p", boost::program_options::value<unsigned short>(),
"Port number")
41 (
"name,n", boost::program_options::value<std::string>(),
"Application Nickname")
42 (
"help,h",
"produce help message");
43 boost::program_options::variables_map vm;
45 boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).run(), vm);
46 boost::program_options::notify(vm);
48 catch (boost::program_options::error
const & e) {
49 std::cerr <<
"Exception from command line processing in " << argv[0]
50 <<
": " << e.what() <<
"\n";
53 if (vm.count(
"help")) {
54 std::cout << desc << std::endl;
58 if (!vm.count(
"port"))
60 TLOG_ERROR(
"Option") << argv[0] <<
" port number not supplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
64 if (!vm.count(
"rank"))
66 TLOG_ERROR(
"Option") << argv[0] <<
" rank not supplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
69 auto rank = vm[
"rank"].as<
int>();
71 std::string name =
"Aggregator";
74 name = vm[
"name"].as<std::string>();
75 TLOG_DEBUG(name +
"Main") <<
"Setting application name to " << name << TLOG_ENDL;
79 TLOG_DEBUG(name +
"Main") <<
"artdaq version " <<
87 if (vm.count(
"config")) {
88 fhicl::ParameterSet pset;
89 if (getenv(
"FHICL_FILE_PATH") ==
nullptr) {
91 <<
"INFO: environment variable FHICL_FILE_PATH was not set. Using \".\"\n";
92 setenv(
"FHICL_FILE_PATH",
".", 0);
94 cet::filepath_lookup_after1 lookup_policy(
"FHICL_FILE_PATH");
95 make_ParameterSet(vm[
"config"].as<std::string>(), lookup_policy, pset);
97 int run = pset.get<
int>(
"run_number", 101);
98 uint64_t timeout = pset.get<uint64_t>(
"transition_timeout", 30);
99 uint64_t timestamp = 0;
101 agg_app.do_initialize(pset, timeout, timestamp);
102 agg_app.do_start(art::RunID(run), timeout, timestamp);
104 TLOG_INFO(name) <<
"Running XMLRPC Commander. To stop, either Control-C or " << std::endl
105 <<
"xmlrpc http://`hostname`:" << vm[
"port"].as<
unsigned short>() <<
"/RPC2 daq.stop" << std::endl
106 <<
"xmlrpc http://`hostname`:" << vm[
"port"].as<unsigned short>() <<
"/RPC2 daq.shutdown" << TLOG_ENDL;
AggregatorApp is an artdaq::Commandable derived class which controls the AggregatorCore.
static artdaq::PackageBuildInfo getPackageBuildInfo()
Gets the version number and build timestmap for artdaq.
The xmlrpc_commander class serves as the XMLRPC server run in each artdaq application.
void setMsgFacAppName(const std::string &appType, unsigned short port)
Set the message facility application name using the specified application type and port number...