2 #include <boost/program_options.hpp>
3 #include <boost/lexical_cast.hpp>
4 #include "artdaq/Application/TaskType.hh"
5 #include "artdaq/DAQdata/Globals.hh"
6 #include "artdaq/Application/AggregatorApp.hh"
7 #include "artdaq/ExternalComms/xmlrpc_commander.hh"
8 #include "artdaq/Application/MPI2/MPISentry.hh"
10 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
11 #include "cetlib/exception.h"
13 int main(
int argc,
char* argv[])
19 int const wanted_threading_level{MPI_THREAD_FUNNELED};
21 MPI_Comm local_group_comm;
22 std::unique_ptr<artdaq::MPISentry> mpiSentry;
26 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::AggregatorTask, local_group_comm));
28 catch (cet::exception& errormsg)
30 TLOG_ERROR(
"AggregatorMain") << errormsg << TLOG_ENDL;
31 TLOG_ERROR(
"AggregatorMain") <<
"MPISentry error encountered in AggregatorMain; exiting..." << TLOG_ENDL;
37 std::string usage = std::string(argv[0]) +
" -p port_number -n name <other-options>";
38 boost::program_options::options_description desc(usage);
41 (
"port,p", boost::program_options::value<unsigned short>(),
"Port number")
42 (
"name,n", boost::program_options::value<std::string>(),
"Application Nickname")
43 (
"help,h",
"produce help message");
45 boost::program_options::variables_map vm;
48 boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).run(), vm);
49 boost::program_options::notify(vm);
51 catch (boost::program_options::error
const& e)
53 TLOG_ERROR(
"Option") <<
"exception from command line processing in " << argv[0] <<
": " << e.what() << TLOG_ENDL;
59 std::cout << desc << std::endl;
63 if (!vm.count(
"port"))
65 TLOG_ERROR(
"Option") << argv[0] <<
" port number not supplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
69 std::string name =
"Aggregator";
72 name = vm[
"name"].as<std::string>();
73 TLOG_DEBUG(name +
"Main") <<
"Setting application name to " << name << TLOG_ENDL;
77 TLOG_DEBUG(name +
"Main") <<
"artdaq version " <<
AggregatorApp is an artdaq::Commandable derived class which controls the AggregatorCore.
The MPISentry class initializes and finalizes the MPI context that the artdaq applciations run in...
int rank() const
Get the MPI rank of the application.
static artdaq::PackageBuildInfo getPackageBuildInfo()
Gets the version number and build timestmap for artdaq.
void configureMessageFacility(char const *progname, bool useConsole=true)
Configure and start the message facility. Provide the program name so that messages will be appropria...
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...