CMS 3D CMS Logo

ExceptionThrowingProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Integration
4 // Class : ExceptionThrowingProducer
5 //
6 // Implementation:
7 // Intentionally throws exceptions in various Framework transitions.
8 // You can configure which transition. Includes some tests of
9 // the Framework behavior after an exception occurs.
10 //
11 // Original Author: W. David Dagenhart
12 // Created: 26 September 2022
13 
28 
29 #include <atomic>
30 #include <limits>
31 #include <memory>
32 
33 constexpr unsigned int kTestStreams = 4;
36 
37 namespace edmtest {
38 
39  namespace {
40  struct Cache {};
41  } // namespace
42 
44  : public edm::global::EDProducer<edm::StreamCache<Cache>, edm::RunCache<Cache>, edm::LuminosityBlockCache<Cache>> {
45  public:
47 
48  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
49 
50  std::shared_ptr<Cache> globalBeginRun(edm::Run const&, edm::EventSetup const&) const override;
51  void globalEndRun(edm::Run const&, edm::EventSetup const&) const override;
52  std::shared_ptr<Cache> globalBeginLuminosityBlock(edm::LuminosityBlock const&,
53  edm::EventSetup const&) const override;
54  void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) const override;
55 
56  std::unique_ptr<Cache> beginStream(edm::StreamID) const override;
57  void streamBeginRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const override;
60  void streamEndRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const override;
61 
62  void endJob() override;
63 
65 
66  private:
67  bool verbose_;
68 
78 
79  mutable std::vector<unsigned int> nStreamBeginLumi_;
80  mutable std::vector<unsigned int> nStreamEndLumi_;
81  mutable std::atomic<unsigned int> nGlobalBeginLumi_{0};
82  mutable std::atomic<unsigned int> nGlobalEndLumi_{0};
83 
84  mutable std::vector<unsigned int> nStreamBeginRun_;
85  mutable std::vector<unsigned int> nStreamEndRun_;
86  mutable std::atomic<unsigned int> nGlobalBeginRun_{0};
87  mutable std::atomic<unsigned int> nGlobalEndRun_{0};
88 
91  mutable unsigned int streamWithBeginLumiException_ = kUnset;
95 
98  mutable unsigned int streamWithBeginRunException_ = kUnset;
102 
103  mutable std::atomic<bool> streamBeginLumiExceptionOccurred_ = false;
104  mutable std::atomic<bool> streamEndLumiExceptionOccurred_ = false;
105  mutable std::atomic<bool> globalBeginLumiExceptionOccurred_ = false;
106 
107  mutable std::atomic<bool> streamBeginRunExceptionOccurred_ = false;
108  mutable std::atomic<bool> streamEndRunExceptionOccurred_ = false;
109  mutable std::atomic<bool> globalBeginRunExceptionOccurred_ = false;
110  };
111 
113  : verbose_(pset.getUntrackedParameter<bool>("verbose")),
114  eventIDThrowOnEvent_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnEvent")),
115  eventIDThrowOnGlobalBeginRun_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnGlobalBeginRun")),
116  eventIDThrowOnGlobalBeginLumi_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnGlobalBeginLumi")),
117  eventIDThrowOnGlobalEndRun_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnGlobalEndRun")),
118  eventIDThrowOnGlobalEndLumi_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnGlobalEndLumi")),
119  eventIDThrowOnStreamBeginRun_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnStreamBeginRun")),
120  eventIDThrowOnStreamBeginLumi_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnStreamBeginLumi")),
121  eventIDThrowOnStreamEndRun_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnStreamEndRun")),
122  eventIDThrowOnStreamEndLumi_(pset.getUntrackedParameter<edm::EventID>("eventIDThrowOnStreamEndLumi")),
123  nStreamBeginLumi_(kTestStreams, 0),
124  nStreamEndLumi_(kTestStreams, 0),
125  nStreamBeginRun_(kTestStreams, 0),
126  nStreamEndRun_(kTestStreams, 0),
127  expectedStreamBeginLumi_(pset.getUntrackedParameter<unsigned int>("expectedStreamBeginLumi")),
128  expectedOffsetNoStreamEndLumi_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoStreamEndLumi")),
129  expectedGlobalBeginLumi_(pset.getUntrackedParameter<unsigned int>("expectedGlobalBeginLumi")),
130  expectedOffsetNoGlobalEndLumi_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoGlobalEndLumi")),
131  expectedOffsetNoWriteLumi_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoWriteLumi")),
132  expectedStreamBeginRun_(pset.getUntrackedParameter<unsigned int>("expectedStreamBeginRun")),
133  expectedOffsetNoStreamEndRun_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoStreamEndRun")),
134  expectedGlobalBeginRun_(pset.getUntrackedParameter<unsigned int>("expectedGlobalBeginRun")),
135  expectedOffsetNoGlobalEndRun_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoGlobalEndRun")),
136  expectedOffsetNoWriteRun_(pset.getUntrackedParameter<unsigned int>("expectedOffsetNoWriteRun")) {}
137 
139  if (event.id() == eventIDThrowOnEvent_) {
140  throw cms::Exception("IntentionalTestException")
141  << "ExceptionThrowingProducer::produce, module configured to throw on: " << eventIDThrowOnEvent_;
142  }
143  }
144 
145  std::shared_ptr<Cache> ExceptionThrowingProducer::globalBeginRun(edm::Run const& run, edm::EventSetup const&) const {
150  throw cms::Exception("IntentionalTestException")
151  << "ExceptionThrowingProducer::globalBeginRun, module configured to throw on: "
153  }
154  return std::make_shared<Cache>();
155  }
156 
158  ++nGlobalEndRun_;
161  throw cms::Exception("IntentionalTestException")
162  << "ExceptionThrowingProducer::globalEndRun, module configured to throw on: " << eventIDThrowOnGlobalEndRun_;
163  }
164  }
165 
167  edm::EventSetup const&) const {
169  if (edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), edm::invalidEventNumber) ==
172  throw cms::Exception("IntentionalTestException")
173  << "ExceptionThrowingProducer::globalBeginLuminosityBlock, module configured to throw on: "
175  }
176  return std::make_shared<Cache>();
177  }
178 
180  edm::EventSetup const&) const {
181  ++nGlobalEndLumi_;
182  if (edm::EventID(lumi.id().run(), lumi.id().luminosityBlock(), edm::invalidEventNumber) ==
184  throw cms::Exception("IntentionalTestException")
185  << "ExceptionThrowingProducer::globalEndLuminosityBlock, module configured to throw on: "
187  }
188  }
189 
191  return std::make_unique<Cache>();
192  }
193 
195  edm::Run const& run,
196  edm::EventSetup const&) const {
197  if (iStream < kTestStreams) {
198  ++nStreamBeginRun_[iStream];
199  }
200 
201  bool expected = false;
204  streamBeginRunExceptionOccurred_.compare_exchange_strong(expected, true)) {
205  // Remember which stream threw
207  throw cms::Exception("IntentionalTestException")
208  << "ExceptionThrowingProducer::streamBeginRun, module configured to throw on: "
210  }
211  }
212 
214  edm::LuminosityBlock const& lumi,
215  edm::EventSetup const&) const {
216  if (iStream < kTestStreams) {
217  ++nStreamBeginLumi_[iStream];
218  }
219 
220  // Throw if this lumi's ID matches the configured ID (this code is written so
221  // that only the first stream to match it will throw).
222  bool expected = false;
223  if (edm::EventID(lumi.run(), lumi.id().luminosityBlock(), edm::invalidEventNumber) ==
225  streamBeginLumiExceptionOccurred_.compare_exchange_strong(expected, true)) {
226  // Remember which stream threw
228 
229  throw cms::Exception("IntentionalTestException")
230  << "ExceptionThrowingProducer::streamBeginLuminosityBlock, module configured to throw on: "
232  }
233  }
234 
236  edm::LuminosityBlock const& lumi,
237  edm::EventSetup const&) const {
238  if (iStream < kTestStreams) {
239  ++nStreamEndLumi_[iStream];
240  }
241 
242  bool expected = false;
243  if (edm::EventID(lumi.run(), lumi.id().luminosityBlock(), edm::invalidEventNumber) ==
245  streamEndLumiExceptionOccurred_.compare_exchange_strong(expected, true)) {
246  throw cms::Exception("IntentionalTestException")
247  << "ExceptionThrowingProducer::streamEndLuminosityBlock, module configured to throw on: "
249  }
250  }
251 
253  edm::Run const& run,
254  edm::EventSetup const&) const {
255  if (iStream < kTestStreams) {
256  ++nStreamEndRun_[iStream];
257  }
258 
259  bool expected = false;
262  streamEndRunExceptionOccurred_.compare_exchange_strong(expected, true)) {
263  throw cms::Exception("IntentionalTestException")
264  << "ExceptionThrowingProducer::streamEndRun, module configured to throw on: " << eventIDThrowOnStreamEndRun_;
265  }
266  }
267 
269  bool testsPass = true;
270 
271  unsigned int totalStreamBeginLumi = 0;
272  unsigned int i = 0;
273  for (auto const& nStreamBeginLumi : nStreamBeginLumi_) {
274  totalStreamBeginLumi += nStreamBeginLumi;
275 
276  // Don't know exact number to expect because streams might skip a lumi so
277  // only throw if it is greater than the maximum possible and we only know
278  // that for sure if the exception was thrown in stream begin lumi.
279  if (nStreamBeginLumi > expectedStreamBeginLumi_ && streamWithBeginLumiException_ != kUnset) {
280  edm::LogAbsolute("ExceptionThrowingProducer")
281  << "FAILED: More than maximum possible number of streamBeginLumi transitions, stream " << i << " saw "
282  << nStreamBeginLumi << " max possible " << expectedStreamBeginLumi_;
283  testsPass = false;
284  }
285  unsigned int expectedStreamEndLumi =
286  (streamWithBeginLumiException_ == i) ? nStreamBeginLumi - 1 : nStreamBeginLumi;
287  if (nStreamEndLumi_[i] != expectedStreamEndLumi) {
288  edm::LogAbsolute("ExceptionThrowingProducer")
289  << "FAILED: Unexpected number of streamEndLumi transitions, stream " << i << " saw " << nStreamEndLumi_[i]
290  << " expected " << expectedStreamEndLumi;
291  testsPass = false;
292  }
293 
294  ++i;
295  }
296 
297  unsigned int totalStreamBeginRun = 0;
298  i = 0;
299  for (auto const& nStreamBeginRun : nStreamBeginRun_) {
300  totalStreamBeginRun += nStreamBeginRun;
301 
302  // Don't know exact number to expect because streams might skip a run (not yet
303  // but probably in the future) so only throw if it is greater than the maximum
304  // possible and we only know that for sure if the exception was thrown in stream begin run.
305  if (nStreamBeginRun > expectedStreamBeginRun_ && streamWithBeginRunException_ != kUnset) {
306  edm::LogAbsolute("ExceptionThrowingProducer")
307  << "FAILED: More than maximum possible number of streamBeginRun transitions, stream " << i << " saw "
308  << nStreamBeginRun << " max possible " << expectedStreamBeginRun_;
309  testsPass = false;
310  }
311  unsigned int expectedStreamEndRun = (streamWithBeginRunException_ == i) ? nStreamBeginRun - 1 : nStreamBeginRun;
312  if (nStreamEndRun_[i] != expectedStreamEndRun) {
313  edm::LogAbsolute("ExceptionThrowingProducer")
314  << "FAILED: Unexpected number of streamEndRun transitions, stream " << i << " saw " << nStreamEndRun_[i]
315  << " expected " << expectedStreamEndRun;
316  testsPass = false;
317  }
318 
319  ++i;
320  }
321 
322  // There has to be at least as many global begin lumi transitions
323  // as expected. Because of concurrency, the Framework might already have
324  // started other lumis ahead of the one where an exception occurs.
326  edm::LogAbsolute("ExceptionThrowingProducer")
327  << "FAILED: Less than the expected number of globalBeginLumi transitions, expected at least "
328  << expectedGlobalBeginLumi_ << " saw " << nGlobalBeginLumi_.load();
329  testsPass = false;
330  }
331 
332  // There has to be at least as many global begin run transitions
333  // as expected. Because of concurrency, the Framework might already have
334  // started other runs ahead of the one where an exception occurs.
336  edm::LogAbsolute("ExceptionThrowingProducer")
337  << "FAILED: Less than the expected number of globalBeginRun transitions, expected at least "
338  << expectedGlobalBeginRun_ << " saw " << nGlobalBeginRun_.load();
339  testsPass = false;
340  }
341 
342  unsigned int expectedGlobalEndLumi =
344  if (nGlobalEndLumi_.load() != expectedGlobalEndLumi) {
345  edm::LogAbsolute("ExceptionThrowingProducer")
346  << "FAILED: number of global end lumi transitions not equal to expected value, expected "
347  << expectedGlobalEndLumi << " saw " << nGlobalEndLumi_.load();
348  testsPass = false;
349  }
350 
351  unsigned int expectedGlobalEndRun =
353  if (nGlobalEndRun_.load() != expectedGlobalEndRun) {
354  edm::LogAbsolute("ExceptionThrowingProducer")
355  << "FAILED: number of global end run transitions not equal to expected value, expected "
356  << expectedGlobalEndRun << " saw " << nGlobalEndRun_.load();
357  testsPass = false;
358  }
359 
361  if (serviceOne->nPreStreamBeginLumi() != totalStreamBeginLumi ||
362  serviceOne->nPostStreamBeginLumi() != totalStreamBeginLumi ||
363  serviceOne->nPreStreamEndLumi() != totalStreamBeginLumi ||
364  serviceOne->nPostStreamEndLumi() != totalStreamBeginLumi ||
365  serviceOne->nPreModuleStreamBeginLumi() != totalStreamBeginLumi * kNumberOfTestModules ||
366  serviceOne->nPostModuleStreamBeginLumi() != totalStreamBeginLumi * kNumberOfTestModules ||
367  serviceOne->nPreModuleStreamEndLumi() !=
368  totalStreamBeginLumi * kNumberOfTestModules - expectedOffsetNoStreamEndLumi_ ||
369  serviceOne->nPostModuleStreamEndLumi() !=
370  totalStreamBeginLumi * kNumberOfTestModules - expectedOffsetNoStreamEndLumi_) {
371  edm::LogAbsolute("ExceptionThrowingProducer")
372  << "FAILED: Unexpected number of service transitions in TestServiceOne, stream lumi";
373  testsPass = false;
374  }
375 
377  if (serviceTwo->nPreStreamBeginLumi() != totalStreamBeginLumi ||
378  serviceTwo->nPostStreamBeginLumi() != totalStreamBeginLumi ||
379  serviceTwo->nPreStreamEndLumi() != totalStreamBeginLumi ||
380  serviceTwo->nPostStreamEndLumi() != totalStreamBeginLumi ||
381  serviceTwo->nPreModuleStreamBeginLumi() != totalStreamBeginLumi * kNumberOfTestModules ||
382  serviceTwo->nPostModuleStreamBeginLumi() != totalStreamBeginLumi * kNumberOfTestModules ||
383  serviceTwo->nPreModuleStreamEndLumi() !=
384  totalStreamBeginLumi * kNumberOfTestModules - expectedOffsetNoStreamEndLumi_ ||
385  serviceTwo->nPostModuleStreamEndLumi() !=
386  totalStreamBeginLumi * kNumberOfTestModules - expectedOffsetNoStreamEndLumi_) {
387  edm::LogAbsolute("ExceptionThrowingProducer")
388  << "FAILED: Unexpected number of service transitions in TestServiceTwo, stream lumi";
389  testsPass = false;
390  }
391 
392  unsigned int nGlobalBeginLumi = nGlobalBeginLumi_.load();
393 
394  if (serviceOne->nPreGlobalBeginLumi() != nGlobalBeginLumi ||
395  serviceOne->nPostGlobalBeginLumi() != nGlobalBeginLumi || serviceOne->nPreGlobalEndLumi() != nGlobalBeginLumi ||
396  serviceOne->nPostGlobalEndLumi() != nGlobalBeginLumi ||
397  serviceOne->nPreModuleGlobalBeginLumi() != nGlobalBeginLumi * kNumberOfTestModules ||
398  serviceOne->nPostModuleGlobalBeginLumi() != nGlobalBeginLumi * kNumberOfTestModules ||
399  serviceOne->nPreModuleGlobalEndLumi() !=
401  serviceOne->nPostModuleGlobalEndLumi() !=
403  serviceOne->nPreGlobalWriteLumi() != nGlobalBeginLumi - expectedOffsetNoWriteLumi_ ||
404  serviceOne->nPostGlobalWriteLumi() != nGlobalBeginLumi - expectedOffsetNoWriteLumi_) {
405  edm::LogAbsolute("ExceptionThrowingProducer")
406  << "FAILED: Unexpected number of service transitions in TestServiceOne, global lumi";
407  testsPass = false;
408  }
409 
410  if (serviceTwo->nPreGlobalBeginLumi() != nGlobalBeginLumi ||
411  serviceTwo->nPostGlobalBeginLumi() != nGlobalBeginLumi || serviceTwo->nPreGlobalEndLumi() != nGlobalBeginLumi ||
412  serviceTwo->nPostGlobalEndLumi() != nGlobalBeginLumi ||
413  serviceTwo->nPreModuleGlobalBeginLumi() != nGlobalBeginLumi * kNumberOfTestModules ||
414  serviceTwo->nPostModuleGlobalBeginLumi() != nGlobalBeginLumi * kNumberOfTestModules ||
415  serviceTwo->nPreModuleGlobalEndLumi() !=
417  serviceTwo->nPostModuleGlobalEndLumi() !=
419  serviceTwo->nPreGlobalWriteLumi() != nGlobalBeginLumi - expectedOffsetNoWriteLumi_ ||
420  serviceTwo->nPostGlobalWriteLumi() != nGlobalBeginLumi - expectedOffsetNoWriteLumi_) {
421  edm::LogAbsolute("ExceptionThrowingProducer")
422  << "FAILED: Unexpected number of service transitions in TestServiceTwo, global lumi";
423  testsPass = false;
424  }
425 
426  if (serviceOne->nPreStreamBeginRun() != totalStreamBeginRun ||
427  serviceOne->nPostStreamBeginRun() != totalStreamBeginRun ||
428  serviceOne->nPreStreamEndRun() != totalStreamBeginRun ||
429  serviceOne->nPostStreamEndRun() != totalStreamBeginRun ||
430  serviceOne->nPreModuleStreamBeginRun() != totalStreamBeginRun * kNumberOfTestModules ||
431  serviceOne->nPostModuleStreamBeginRun() != totalStreamBeginRun * kNumberOfTestModules ||
432  serviceOne->nPreModuleStreamEndRun() !=
433  totalStreamBeginRun * kNumberOfTestModules - expectedOffsetNoStreamEndRun_ ||
434  serviceOne->nPostModuleStreamEndRun() !=
435  totalStreamBeginRun * kNumberOfTestModules - expectedOffsetNoStreamEndRun_) {
436  edm::LogAbsolute("ExceptionThrowingProducer")
437  << "FAILED: Unexpected number of service transitions in TestServiceOne, stream run";
438  testsPass = false;
439  }
440 
441  if (serviceTwo->nPreStreamBeginRun() != totalStreamBeginRun ||
442  serviceTwo->nPostStreamBeginRun() != totalStreamBeginRun ||
443  serviceTwo->nPreStreamEndRun() != totalStreamBeginRun ||
444  serviceTwo->nPostStreamEndRun() != totalStreamBeginRun ||
445  serviceTwo->nPreModuleStreamBeginRun() != totalStreamBeginRun * kNumberOfTestModules ||
446  serviceTwo->nPostModuleStreamBeginRun() != totalStreamBeginRun * kNumberOfTestModules ||
447  serviceTwo->nPreModuleStreamEndRun() !=
448  totalStreamBeginRun * kNumberOfTestModules - expectedOffsetNoStreamEndRun_ ||
449  serviceTwo->nPostModuleStreamEndRun() !=
450  totalStreamBeginRun * kNumberOfTestModules - expectedOffsetNoStreamEndRun_) {
451  edm::LogAbsolute("ExceptionThrowingProducer")
452  << "FAILED: Unexpected number of service transitions in TestServiceTwo, stream run";
453  testsPass = false;
454  }
455 
456  unsigned int nGlobalBeginRun = nGlobalBeginRun_.load();
457 
458  if (serviceOne->nPreGlobalBeginRun() != nGlobalBeginRun || serviceOne->nPostGlobalBeginRun() != nGlobalBeginRun ||
459  serviceOne->nPreGlobalEndRun() != nGlobalBeginRun || serviceOne->nPostGlobalEndRun() != nGlobalBeginRun ||
460  serviceOne->nPreModuleGlobalBeginRun() != nGlobalBeginRun * kNumberOfTestModules ||
461  serviceOne->nPostModuleGlobalBeginRun() != nGlobalBeginRun * kNumberOfTestModules ||
462  serviceOne->nPreModuleGlobalEndRun() !=
464  serviceOne->nPostModuleGlobalEndRun() !=
466  serviceOne->nPreGlobalWriteRun() != nGlobalBeginRun - expectedOffsetNoWriteRun_ ||
467  serviceOne->nPostGlobalWriteRun() != nGlobalBeginRun - expectedOffsetNoWriteRun_) {
468  edm::LogAbsolute("ExceptionThrowingProducer")
469  << "FAILED: Unexpected number of service transitions in TestServiceOne, global run";
470  testsPass = false;
471  }
472 
473  if (serviceTwo->nPreGlobalBeginRun() != nGlobalBeginRun || serviceTwo->nPostGlobalBeginRun() != nGlobalBeginRun ||
474  serviceTwo->nPreGlobalEndRun() != nGlobalBeginRun || serviceTwo->nPostGlobalEndRun() != nGlobalBeginRun ||
475  serviceTwo->nPreModuleGlobalBeginRun() != nGlobalBeginRun * kNumberOfTestModules ||
476  serviceTwo->nPostModuleGlobalBeginRun() != nGlobalBeginRun * kNumberOfTestModules ||
477  serviceTwo->nPreModuleGlobalEndRun() !=
479  serviceTwo->nPostModuleGlobalEndRun() !=
481  serviceTwo->nPreGlobalWriteRun() != nGlobalBeginRun - expectedOffsetNoWriteRun_ ||
482  serviceTwo->nPostGlobalWriteRun() != nGlobalBeginRun - expectedOffsetNoWriteRun_) {
483  edm::LogAbsolute("ExceptionThrowingProducer")
484  << "FAILED: Unexpected number of service transitions in TestServiceTwo, global run";
485  testsPass = false;
486  }
487 
488  if (verbose_) {
489  edm::LogAbsolute("ExceptionThrowingProducer") << "nGlobalBeginLumi_ = " << nGlobalBeginLumi_;
490  edm::LogAbsolute("ExceptionThrowingProducer") << "nGlobalEndLumi_ = " << nGlobalEndLumi_;
491  edm::LogAbsolute("ExceptionThrowingProducer") << "nGlobalBeginRun_ = " << nGlobalBeginRun_;
492  edm::LogAbsolute("ExceptionThrowingProducer") << "nGlobalEndRun_ = " << nGlobalEndRun_;
493 
494  edm::LogAbsolute("ExceptionThrowingProducer")
495  << "serviceOne->nPreStreamBeginLumi = " << serviceOne->nPreStreamBeginLumi();
496  edm::LogAbsolute("ExceptionThrowingProducer")
497  << "serviceOne->nPostStreamBeginLumi = " << serviceOne->nPostStreamBeginLumi();
498  edm::LogAbsolute("ExceptionThrowingProducer")
499  << "serviceOne->nPreStreamEndLumi = " << serviceOne->nPreStreamEndLumi();
500  edm::LogAbsolute("ExceptionThrowingProducer")
501  << "serviceOne->nPostStreamEndLumi = " << serviceOne->nPostStreamEndLumi();
502  edm::LogAbsolute("ExceptionThrowingProducer")
503  << "serviceOne->nPreModuleStreamBeginLumi = " << serviceOne->nPreModuleStreamBeginLumi();
504  edm::LogAbsolute("ExceptionThrowingProducer")
505  << "serviceOne->nPostModuleStreamBeginLumi = " << serviceOne->nPostModuleStreamBeginLumi();
506  edm::LogAbsolute("ExceptionThrowingProducer")
507  << "serviceOne->nPreModuleStreamEndLumi = " << serviceOne->nPreModuleStreamEndLumi();
508  edm::LogAbsolute("ExceptionThrowingProducer")
509  << "serviceOne->nPostModuleStreamEndLumi = " << serviceOne->nPostModuleStreamEndLumi() << "\n";
510 
511  edm::LogAbsolute("ExceptionThrowingProducer")
512  << "serviceOne->nPreGlobalBeginLumi = " << serviceOne->nPreGlobalBeginLumi();
513  edm::LogAbsolute("ExceptionThrowingProducer")
514  << "serviceOne->nPostGlobalBeginLumi = " << serviceOne->nPostGlobalBeginLumi();
515  edm::LogAbsolute("ExceptionThrowingProducer")
516  << "serviceOne->nPreGlobalEndLumi = " << serviceOne->nPreGlobalEndLumi();
517  edm::LogAbsolute("ExceptionThrowingProducer")
518  << "serviceOne->nPostGlobalEndLumi = " << serviceOne->nPostGlobalEndLumi();
519  edm::LogAbsolute("ExceptionThrowingProducer")
520  << "serviceOne->nPreModuleGlobalBeginLumi = " << serviceOne->nPreModuleGlobalBeginLumi();
521  edm::LogAbsolute("ExceptionThrowingProducer")
522  << "serviceOne->nPostModuleGlobalBeginLumi = " << serviceOne->nPostModuleGlobalBeginLumi();
523  edm::LogAbsolute("ExceptionThrowingProducer")
524  << "serviceOne->nPreModuleGlobalEndLumi = " << serviceOne->nPreModuleGlobalEndLumi();
525  edm::LogAbsolute("ExceptionThrowingProducer")
526  << "serviceOne->nPostModuleGlobalEndLumi = " << serviceOne->nPostModuleGlobalEndLumi();
527  edm::LogAbsolute("ExceptionThrowingProducer")
528  << "serviceOne->nPreGlobalWriteLumi = " << serviceOne->nPreGlobalWriteLumi();
529  edm::LogAbsolute("ExceptionThrowingProducer")
530  << "serviceOne->nPostGlobalWriteLumi = " << serviceOne->nPostGlobalWriteLumi() << "\n";
531 
532  edm::LogAbsolute("ExceptionThrowingProducer")
533  << "serviceOne->nPreStreamBeginRun = " << serviceOne->nPreStreamBeginRun();
534  edm::LogAbsolute("ExceptionThrowingProducer")
535  << "serviceOne->nPostStreamBeginRun = " << serviceOne->nPostStreamBeginRun();
536  edm::LogAbsolute("ExceptionThrowingProducer")
537  << "serviceOne->nPreStreamEndRun = " << serviceOne->nPreStreamEndRun();
538  edm::LogAbsolute("ExceptionThrowingProducer")
539  << "serviceOne->nPostStreamEndRun = " << serviceOne->nPostStreamEndRun();
540  edm::LogAbsolute("ExceptionThrowingProducer")
541  << "serviceOne->nPreModuleStreamBeginRun = " << serviceOne->nPreModuleStreamBeginRun();
542  edm::LogAbsolute("ExceptionThrowingProducer")
543  << "serviceOne->nPostModuleStreamBeginRun = " << serviceOne->nPostModuleStreamBeginRun();
544  edm::LogAbsolute("ExceptionThrowingProducer")
545  << "serviceOne->nPreModuleStreamEndRun = " << serviceOne->nPreModuleStreamEndRun();
546  edm::LogAbsolute("ExceptionThrowingProducer")
547  << "serviceOne->nPostModuleStreamEndRun = " << serviceOne->nPostModuleStreamEndRun() << "\n";
548 
549  edm::LogAbsolute("ExceptionThrowingProducer")
550  << "serviceOne->nPreGlobalBeginRun = " << serviceOne->nPreGlobalBeginRun();
551  edm::LogAbsolute("ExceptionThrowingProducer")
552  << "serviceOne->nPostGlobalBeginRun = " << serviceOne->nPostGlobalBeginRun();
553  edm::LogAbsolute("ExceptionThrowingProducer")
554  << "serviceOne->nPreGlobalEndRun = " << serviceOne->nPreGlobalEndRun();
555  edm::LogAbsolute("ExceptionThrowingProducer")
556  << "serviceOne->nPostGlobalEndRun = " << serviceOne->nPostGlobalEndRun();
557  edm::LogAbsolute("ExceptionThrowingProducer")
558  << "serviceOne->nPreModuleGlobalBeginRun = " << serviceOne->nPreModuleGlobalBeginRun();
559  edm::LogAbsolute("ExceptionThrowingProducer")
560  << "serviceOne->nPostModuleGlobalBeginRun = " << serviceOne->nPostModuleGlobalBeginRun();
561  edm::LogAbsolute("ExceptionThrowingProducer")
562  << "serviceOne->nPreModuleGlobalEndRun = " << serviceOne->nPreModuleGlobalEndRun();
563  edm::LogAbsolute("ExceptionThrowingProducer")
564  << "serviceOne->nPostModuleGlobalEndRun = " << serviceOne->nPostModuleGlobalEndRun();
565  edm::LogAbsolute("ExceptionThrowingProducer")
566  << "serviceOne->nPreGlobalWriteRun = " << serviceOne->nPreGlobalWriteRun();
567  edm::LogAbsolute("ExceptionThrowingProducer")
568  << "serviceOne->nPostGlobalWriteRun = " << serviceOne->nPostGlobalWriteRun() << "\n";
569  }
570 
571  if (testsPass) {
572  edm::LogAbsolute("ExceptionThrowingProducer") << "All tests in ExceptionThrowingProducer PASSED";
573  } else {
574  edm::LogAbsolute("ExceptionThrowingProducer") << "At least one test in ExceptionThrowingProducer FAILED";
575  }
576  }
577 
580  edm::EventID invalidEventID;
581  desc.addUntracked<bool>("verbose", false);
582  desc.addUntracked<edm::EventID>("eventIDThrowOnEvent", invalidEventID);
583  desc.addUntracked<edm::EventID>("eventIDThrowOnGlobalBeginRun", invalidEventID);
584  desc.addUntracked<edm::EventID>("eventIDThrowOnGlobalBeginLumi", invalidEventID);
585  desc.addUntracked<edm::EventID>("eventIDThrowOnGlobalEndRun", invalidEventID);
586  desc.addUntracked<edm::EventID>("eventIDThrowOnGlobalEndLumi", invalidEventID);
587  desc.addUntracked<edm::EventID>("eventIDThrowOnStreamBeginRun", invalidEventID);
588  desc.addUntracked<edm::EventID>("eventIDThrowOnStreamBeginLumi", invalidEventID);
589  desc.addUntracked<edm::EventID>("eventIDThrowOnStreamEndRun", invalidEventID);
590  desc.addUntracked<edm::EventID>("eventIDThrowOnStreamEndLumi", invalidEventID);
591 
592  desc.addUntracked<unsigned int>("expectedStreamBeginLumi", kUnset);
593  desc.addUntracked<unsigned int>("expectedOffsetNoStreamEndLumi", 0);
594  desc.addUntracked<unsigned int>("expectedGlobalBeginLumi", 0);
595  desc.addUntracked<unsigned int>("expectedOffsetNoGlobalEndLumi", 0);
596  desc.addUntracked<unsigned int>("expectedOffsetNoWriteLumi", 0);
597 
598  desc.addUntracked<unsigned int>("expectedStreamBeginRun", kUnset);
599  desc.addUntracked<unsigned int>("expectedOffsetNoStreamEndRun", 0);
600  desc.addUntracked<unsigned int>("expectedGlobalBeginRun", 0);
601  desc.addUntracked<unsigned int>("expectedOffsetNoGlobalEndRun", 0);
602  desc.addUntracked<unsigned int>("expectedOffsetNoWriteRun", 0);
603 
604  descriptions.addDefault(desc);
605  }
606 
607 } // namespace edmtest
unsigned int nPreStreamEndLumi() const
unsigned int nPreModuleGlobalBeginLumi() const
std::vector< unsigned int > nStreamBeginRun_
unsigned int nPreStreamBeginLumi() const
unsigned int nPreStreamBeginRun() const
constexpr unsigned int kTestStreams
unsigned int nPreStreamBeginLumi() const
unsigned int nPreModuleStreamBeginLumi() const
std::vector< unsigned int > nStreamBeginLumi_
unsigned int nPreModuleGlobalBeginLumi() const
unsigned int nPostGlobalEndLumi() const
unsigned int nPostStreamBeginLumi() const
std::shared_ptr< Cache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
std::unique_ptr< Cache > beginStream(edm::StreamID) const override
unsigned int nPostModuleStreamEndLumi() const
unsigned int nPreGlobalEndRun() const
unsigned int nPostGlobalBeginRun() const
unsigned int nPreModuleStreamBeginRun() const
unsigned int nPreGlobalBeginLumi() const
unsigned int nPostGlobalBeginLumi() const
unsigned int nPostStreamBeginRun() const
std::vector< unsigned int > nStreamEndRun_
unsigned int nPreModuleGlobalEndRun() const
static void fillDescriptions(edm::ConfigurationDescriptions &)
std::atomic< unsigned int > nGlobalBeginLumi_
unsigned int nPostGlobalEndLumi() const
unsigned int nPostModuleGlobalEndRun() const
unsigned int nPreGlobalEndLumi() const
unsigned int nPostGlobalWriteLumi() const
unsigned int nPostModuleStreamBeginLumi() const
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
EventNumber_t const invalidEventNumber
unsigned int nPreGlobalBeginLumi() const
unsigned int nPreModuleStreamBeginLumi() const
void addDefault(ParameterSetDescription const &psetDescription)
unsigned int nPostModuleGlobalBeginLumi() const
unsigned int nPreGlobalWriteRun() const
unsigned int nPostStreamBeginLumi() const
unsigned int nPreStreamBeginRun() const
unsigned int nPostGlobalBeginRun() const
unsigned int nPostGlobalEndRun() const
unsigned int nPreModuleStreamBeginRun() const
std::atomic< unsigned int > nGlobalEndRun_
unsigned int nPostStreamEndRun() const
unsigned int nPreGlobalEndRun() const
unsigned int nPreGlobalBeginRun() const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void streamBeginLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
unsigned int nPreStreamEndLumi() const
unsigned int nPreModuleGlobalBeginRun() const
void streamBeginRun(edm::StreamID, edm::Run const &, edm::EventSetup const &) const override
unsigned int nPreGlobalWriteLumi() const
unsigned int nPostModuleGlobalBeginLumi() const
LuminosityBlockNumber_t const invalidLuminosityBlockNumber
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
unsigned int nPreStreamEndRun() const
unsigned int nPreGlobalWriteRun() const
unsigned int nPreModuleGlobalEndLumi() const
constexpr unsigned int kNumberOfTestModules
unsigned int nPreModuleGlobalBeginRun() const
unsigned int nPostModuleGlobalBeginRun() const
std::shared_ptr< Cache > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
unsigned int nPostModuleGlobalEndLumi() const
unsigned int nPostModuleStreamEndLumi() const
unsigned int nPostGlobalWriteLumi() const
unsigned int nPreGlobalWriteLumi() const
unsigned int nPostStreamEndLumi() const
unsigned int nPostModuleGlobalBeginRun() const
unsigned int nPostGlobalBeginLumi() const
ExceptionThrowingProducer(edm::ParameterSet const &)
std::atomic< unsigned int > nGlobalEndLumi_
void streamEndRun(edm::StreamID, edm::Run const &, edm::EventSetup const &) const override
unsigned int nPostModuleStreamBeginRun() const
unsigned int nPostModuleGlobalEndLumi() const
unsigned int nPostModuleGlobalEndRun() const
constexpr unsigned int kUnset
unsigned int nPreStreamEndRun() const
unsigned int nPreModuleStreamEndLumi() const
void streamEndLuminosityBlock(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &) const override
unsigned int nPreModuleStreamEndRun() const
HLT enums.
unsigned int nPostModuleStreamEndRun() const
unsigned int nPreModuleGlobalEndLumi() const
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
std::vector< unsigned int > nStreamEndLumi_
unsigned int nPostStreamEndRun() const
unsigned int nPostGlobalWriteRun() const
unsigned int nPreModuleStreamEndLumi() const
unsigned int nPostGlobalWriteRun() const
unsigned int nPostModuleStreamEndRun() const
Log< level::System, true > LogAbsolute
unsigned int nPreModuleGlobalEndRun() const
unsigned int nPostGlobalEndRun() const
unsigned int value() const
Definition: StreamID.h:43
std::atomic< unsigned int > nGlobalBeginRun_
unsigned int nPreModuleStreamEndRun() const
unsigned int nPostModuleStreamBeginRun() const
unsigned int nPostStreamBeginRun() const
unsigned int nPostModuleStreamBeginLumi() const
Definition: event.py:1
Definition: Run.h:45
unsigned int nPreGlobalEndLumi() const
unsigned int nPostStreamEndLumi() const
unsigned int nPreGlobalBeginRun() const