1 #include "boost/program_options.hpp"
10 #include "DataFormats/TestObjects/interface/ToyProducts.h"
11 #include "DataFormats/TestObjects/interface/ThingCollection.h"
27 using namespace edm::shared_memory;
33 auto run = tester_.testBeginRun(iRun);
34 return *
run.get<edmtest::ThingCollection>(
"beginRun");
38 auto lumi = tester_.testBeginLuminosityBlock(iLumi);
39 return *
lumi.get<edmtest::ThingCollection>(
"beginLumi");
43 auto event = tester_.test();
44 return *
event.get<edmtest::ThingCollection>();
48 auto lumi = tester_.testEndLuminosityBlock();
49 return *
lumi.get<edmtest::ThingCollection>(
"endLumi");
53 auto run = tester_.testEndRun();
54 return *
run.get<edmtest::ThingCollection>(
"endRun");
65 descString +=
"] memory_name";
66 boost::program_options::options_description
desc(descString);
70 boost::program_options::value<std::string>(),
71 "memory name")(
kUniqueIDCommandOpt, boost::program_options::value<std::string>(),
"unique id");
73 boost::program_options::positional_options_description
p;
77 boost::program_options::options_description all_options(
"All Options");
78 all_options.add(desc);
80 boost::program_options::variables_map vm;
82 store(boost::program_options::command_line_parser(argc, argv).
options(all_options).positional(p).
run(), vm);
85 std::cout << argv[0] <<
": Error while trying to process command line arguments:\n"
86 << iException.what() <<
"\nFor usage and an options list, please do 'cmsRun --help'.";
96 std::cout <<
" no argument given" << std::endl;
101 std::cout <<
" no second argument given" << std::endl;
123 auto lockPtr = communicationChannel.
accessLock();
132 TCSerializer serializer(sm_buffer);
133 TCSerializer br_serializer(sm_buffer);
134 TCSerializer bl_serializer(sm_buffer);
135 TCSerializer el_serializer(sm_buffer);
136 TCSerializer er_serializer(sm_buffer);
138 std::cerr << uniqueID <<
" process: initializing " << std::endl;
143 for (
int i = 0;
i < nlines; ++
i) {
145 std::getline(std::cin, c);
147 configuration += c +
"\n";
150 Harness harness(configuration);
155 std::cerr << uniqueID <<
" process: done initializing" << std::endl;
158 std::cerr << uniqueID <<
" process: waiting " << counter << std::endl;
161 switch (iTransition) {
163 std::cerr << uniqueID <<
" process: start beginRun " << std::endl;
166 br_serializer.serialize(
value);
167 std::cerr << uniqueID <<
" process: end beginRun " <<
value.size() << std::endl;
172 std::cerr << uniqueID <<
" process: start beginLumi " << std::endl;
175 bl_serializer.serialize(
value);
176 std::cerr << uniqueID <<
" process: end beginLumi " <<
value.size() << std::endl;
181 std::cerr << uniqueID <<
" process: integrating " << counter << std::endl;
184 std::cerr << uniqueID <<
" process: integrated " << counter << std::endl;
186 serializer.serialize(
value);
187 std::cerr << uniqueID <<
" process: " <<
value.size() <<
" " << counter << std::endl;
192 std::cerr << uniqueID <<
" process: start endLumi " << std::endl;
195 el_serializer.serialize(
value);
196 std::cerr << uniqueID <<
" process: end endLumi " <<
value.size() << std::endl;
201 std::cerr << uniqueID <<
" process: start endRun " << std::endl;
204 er_serializer.serialize(
value);
205 std::cerr << uniqueID <<
" process: end endRun " <<
value.size() << std::endl;
213 std::cerr << uniqueID <<
" process: notifying and waiting" << counter << std::endl;
217 std::cerr <<
"caught exception \n" << iExcept.what() <<
"\n";
edmtest::ThingCollection getEndLumiValue()
const edm::EventSetup & c
edmtest::ThingCollection getEventValue()
boost::interprocess::scoped_lock< boost::interprocess::named_mutex > * accessLock()
the lock is made accessible so that the WorkerMonitorThread can be used to unlock it in the event of ...
edm::test::TestProcessor tester_
edmtest::ThingCollection getBeginLumiValue(unsigned int iLumi)
void handleTransitions(F &&iF)
void setupSignalHandling()
Sets the unix signal handler which communicates with the thread.
void setAction(std::function< void()> iFunc)
static char const *const kUniqueIDCommandOpt
static char const *const kUniqueIDOpt
void workerSetupDone()
Matches the ControllerChannel::setupWorker call.
Harness(std::string const &iConfig)
static char const *const kMemoryNameOpt
BufferInfo * fromWorkerBufferInfo()
This can be used with WriteBuffer to keep Controller and Worker in sync.
edmtest::ThingCollection getEndRunValue()
static std::atomic< unsigned int > counter
static char const *const kMemoryNameCommandOpt
static char const *const kHelpOpt
static char const *const kHelpCommandOpt
edmtest::ThingCollection getBeginRunValue(unsigned int iRun)