34 #include "oneapi/tbb/concurrent_vector.h" 93 if (iTrans ==
"IsStop") {
96 if (iTrans ==
"IsFile") {
99 if (iTrans ==
"IsRun") {
102 if (iTrans ==
"IsLumi") {
105 if (iTrans ==
"IsEvent") {
114 std::vector<std::tuple<Phase, edm::EventID, int>> expectedValues(
115 std::vector<std::pair<Transition, edm::EventID>>
const& iTrans,
int iNStreams) {
116 std::vector<std::tuple<Phase, edm::EventID, int>> returnValue;
117 returnValue.reserve(iTrans.size());
122 for (
auto const& tran : iTrans) {
123 switch (tran.first) {
129 if (
lastRun.run() != maxIDValue) {
131 for (
int i = 0;
i < iNStreams; ++
i) {
138 for (
int i = 0;
i < iNStreams; ++
i) {
149 for (
int i = 0;
i < iNStreams; ++
i) {
156 for (
int i = 0;
i < iNStreams; ++
i) {
174 for (
int i = 0;
i < iNStreams; ++
i) {
179 if (
lastRun.run() != maxIDValue) {
181 for (
int i = 0;
i < iNStreams; ++
i) {
194 p.getUntrackedParameter<
EventID>(
"id"));
232 desc.setComment(
"Checks that the transitions specified occur during the job.");
237 desc.addVPSetUntracked(
"transitions", trans, {{}});
238 descriptions.
add(
"CheckTransitions",
desc);
246 std::vector<std::tuple<Phase, edm::EventID, int>> orderedSeen;
250 auto s = std::get<2>(
i);
251 if (std::get<1>(
i).event() > 0) {
254 orderedSeen.emplace_back(std::get<0>(
i), std::get<1>(
i),
s);
256 std::sort(orderedSeen.begin(), orderedSeen.end());
258 auto orderedExpected = expectedV;
259 std::sort(orderedExpected.begin(), orderedExpected.end());
264 unsigned int nSkippedStreamLumiTransitions = 0;
268 std::vector<std::tuple<Phase, edm::EventID, int>> expectedSkippedStreamEndLumi;
269 std::vector<std::tuple<Phase, edm::EventID, int>> seenSkippedStreamEndLumi;
274 std::set<std::tuple<Phase, edm::EventID, int>> seenGlobalBeginLumi;
275 std::set<std::tuple<Phase, edm::EventID, int>> seenStreamBeginLumi;
277 auto itOS = orderedSeen.begin();
278 for (
auto itOE = orderedExpected.begin(); itOE != orderedExpected.end(); ++itOE) {
279 if (itOS == orderedSeen.end()) {
284 seenGlobalBeginLumi.emplace(*itOS);
286 if (std::get<0>(*itOS) ==
Phase::kBeginLumi && (std::get<2>(*itOS) > -1 && std::get<2>(*itOS) < 1000)) {
289 seenStreamBeginLumi.emplace(std::get<0>(*itOS), std::get<1>(*itOS), -1);
293 (std::get<2>(*itOE) > -1 && std::get<2>(*itOE) < 1000)) {
294 ++nSkippedStreamLumiTransitions;
296 expectedSkippedStreamEndLumi.emplace_back(
Phase::kEndLumi, std::get<1>(*itOE), std::get<2>(*itOE));
298 seenSkippedStreamEndLumi.emplace_back(*itOE);
303 if (*itOE != *itOS) {
304 auto syncOE = std::get<1>(*itOE);
305 auto syncOS = std::get<1>(*itOS);
306 std::cout <<
"Different ordering " << syncOE <<
" " << std::get<2>(*itOE) <<
"\n" 307 <<
" " << syncOS <<
" " << std::get<2>(*itOS) <<
"\n";
313 if (seenGlobalBeginLumi != seenStreamBeginLumi) {
314 std::cout <<
"We didn't see at least one stream begin lumi for every global begin lumi" << std::endl;
318 if (expectedSkippedStreamEndLumi != seenSkippedStreamEndLumi) {
319 std::cout <<
"Skipped stream begin and end lumi transitions do not match" << std::endl;
323 if (orderedSeen.size() + nSkippedStreamLumiTransitions != orderedExpected.size()) {
324 std::cout <<
"Wrong number of transition " << orderedSeen.size() <<
" " << orderedExpected.size() << std::endl;
void watchPreEvent(PreEvent::slot_type const &iSlot)
CheckTransitions(const ParameterSet &, ActivityRegistry &)
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &)
void watchPreallocate(Preallocate::slot_type const &iSlot)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
static RunNumber_t maxRunNumber()
void watchPreGlobalEndLumi(PreGlobalEndLumi::slot_type const &iSlot)
void watchPreStreamEndRun(PreStreamEndRun::slot_type const &iSlot)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
~CheckTransitions() noexcept(false)
void preStreamEndLumi(StreamContext const &)
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
void preCloseFile(std::string const &lfn)
std::vector< std::pair< Transition, edm::EventID > > m_expectedTransitions
void preEvent(StreamContext const &)
void preStreamEndRun(StreamContext const &)
T getUntrackedParameter(std::string const &, T const &) const
void preStreamBeginLumi(StreamContext const &)
void watchPreOpenFile(PreOpenFile::slot_type const &iSlot)
void watchPreGlobalEndRun(PreGlobalEndRun::slot_type const &iSlot)
StreamID const & streamID() const
void preGlobalEndRun(GlobalContext const &)
void preGlobalBeginRun(GlobalContext const &)
LuminosityBlockID const & luminosityBlockID() const
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
#define DEFINE_FWK_SERVICE(type)
oneapi::tbb::concurrent_vector< std::tuple< Phase, edm::EventID, int > > m_seenTransitions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void watchPreCloseFile(PreCloseFile::slot_type const &iSlot)
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void preGlobalBeginLumi(GlobalContext const &)
void watchPreStreamBeginRun(PreStreamBeginRun::slot_type const &iSlot)
void preStreamBeginRun(StreamContext const &)
EventID const & eventID() const
void preGlobalEndLumi(GlobalContext const &)
void preallocate(service::SystemBounds const &)
void preOpenFile(std::string const &)