#include <EPStates.h>
Classes | |
class | LumiID |
Public Types | |
typedef sc::transition< Run, NewRun, HandleRuns,&HandleRuns::finalizeRun > | reactions |
Public Member Functions | |
bool | checkInvariant () |
LumiID const & | currentLumi () const |
bool | currentLumiEmpty () const |
void | exit () |
void | finalizeLumi () |
HandleLumis (my_context ctx) | |
void | markLumiNonEmpty () |
void | setupCurrentLumi () |
~HandleLumis () | |
Private Attributes | |
LumiID | currentLumi_ |
bool | currentLumiEmpty_ |
edm::IEventProcessor & | ep_ |
bool | exitCalled_ |
bool | lumiException_ |
Definition at line 313 of file EPStates.h.
typedef sc::transition<Run, NewRun, HandleRuns, &HandleRuns::finalizeRun> statemachine::HandleLumis::reactions |
Definition at line 339 of file EPStates.h.
statemachine::HandleLumis::HandleLumis | ( | my_context | ctx | ) |
Definition at line 437 of file EPStates.cc.
References checkInvariant().
: my_base(ctx), ep_(context<Machine>().ep()), exitCalled_(false), currentLumiEmpty_(true), currentLumi_(InvalidLumiID), lumiException_(false) { checkInvariant(); }
statemachine::HandleLumis::~HandleLumis | ( | ) |
Definition at line 457 of file EPStates.cc.
References checkInvariant(), ExpressReco_HICollisions_FallBack::e, ep_, exception, exitCalled_, cms::Exception::explainSelf(), finalizeLumi(), lumiException_, argparse::message, runTheMatrix::msg, and edm::IEventProcessor::setExceptionMessageLumis().
{ if (!exitCalled_) { try { checkInvariant(); if (!lumiException_ && !context<HandleRuns>().runException()) { finalizeLumi(); } } catch (cms::Exception& e) { std::ostringstream message; message << "------------------------------------------------------------\n" << "Another exception was caught while trying to clean up lumis after\n" << "the primary exception. We give up trying to clean up lumis at\n" << "this point. The description of this additional exception follows:\n" << "cms::Exception\n" << e.explainSelf(); std::string msg(message.str()); ep_.setExceptionMessageLumis(msg); } catch (std::bad_alloc& e) { std::ostringstream message; message << "------------------------------------------------------------\n" << "Another exception was caught while trying to clean up lumis\n" << "after the primary exception. We give up trying to clean up lumis\n" << "at this point. This additional exception was a\n" << "std::bad_alloc exception thrown inside HandleLumis::finalizeLumi.\n" << "The job has probably exhausted the virtual memory available\n" << "to the process.\n"; std::string msg(message.str()); ep_.setExceptionMessageLumis(msg); } catch (std::exception& e) { std::ostringstream message; message << "------------------------------------------------------------\n" << "Another exception was caught while trying to clean up lumis after\n" << "the primary exception. We give up trying to clean up lumis at\n" << "this point. This additional exception was a\n" << "standard library exception thrown inside HandleLumis::finalizeLumi\n" << e.what() << "\n"; std::string msg(message.str()); ep_.setExceptionMessageLumis(msg); } catch (...) { std::ostringstream message; message << "------------------------------------------------------------\n" << "Another exception was caught while trying to clean up lumis after\n" << "the primary exception. We give up trying to clean up lumis at\n" << "this point. This additional exception was of unknown type and\n" << "thrown inside HandleLumis::finalizeLumi\n"; std::string msg(message.str()); ep_.setExceptionMessageLumis(msg); } } }
bool statemachine::HandleLumis::checkInvariant | ( | ) |
Definition at line 512 of file EPStates.cc.
Referenced by exit(), HandleLumis(), and ~HandleLumis().
{ assert(context<HandleRuns>().currentRun() != INVALID_RUN); return true; }
HandleLumis::LumiID const & statemachine::HandleLumis::currentLumi | ( | ) | const |
Definition at line 517 of file EPStates.cc.
References currentLumi_.
Referenced by finalizeLumi(), markLumiNonEmpty(), and setupCurrentLumi().
{ return currentLumi_; }
bool statemachine::HandleLumis::currentLumiEmpty | ( | ) | const |
Definition at line 519 of file EPStates.cc.
References currentLumiEmpty_.
{ return currentLumiEmpty_; }
void statemachine::HandleLumis::exit | ( | ) |
Definition at line 448 of file EPStates.cc.
References edm::IEventProcessor::alreadyHandlingException(), checkInvariant(), ep_, exitCalled_, finalizeLumi(), and lumiException_.
{ if (ep_.alreadyHandlingException()) return; exitCalled_ = true; checkInvariant(); if (!lumiException_ && !context<HandleRuns>().runException()) { finalizeLumi(); } }
void statemachine::HandleLumis::finalizeLumi | ( | ) |
Definition at line 538 of file EPStates.cc.
References currentLumi(), currentLumi_, currentLumiEmpty_, edm::IEventProcessor::deleteLumiFromCache(), edm::IEventProcessor::endLumi(), ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, CrabTask::run, and edm::IEventProcessor::writeLumi().
Referenced by exit(), and ~HandleLumis().
{ lumiException_ = true; if (!currentLumiEmpty_ || context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) { ep_.endLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi()); } ep_.writeLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi()); ep_.deleteLumiFromCache(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi()); currentLumi_ = InvalidLumiID; lumiException_ = false; }
void statemachine::HandleLumis::markLumiNonEmpty | ( | ) |
Definition at line 554 of file EPStates.cc.
References edm::IEventProcessor::beginLumi(), currentLumi(), currentLumiEmpty_, ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, and CrabTask::run.
{ if (currentLumiEmpty_) { if (context<Machine>().emptyRunLumiMode() != handleEmptyRunsAndLumis) { lumiException_ = true; ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi()); lumiException_ = false; } currentLumiEmpty_ = false; } }
void statemachine::HandleLumis::setupCurrentLumi | ( | ) |
Definition at line 521 of file EPStates.cc.
References edm::IEventProcessor::beginLumi(), currentLumi(), currentLumi_, currentLumiEmpty_, ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, statemachine::Run::processHistoryID(), edm::IEventProcessor::readAndCacheLumi(), CrabTask::run, and statemachine::Run::runNumber().
{ Run const& run = context<HandleRuns>().currentRun(); assert (run != INVALID_RUN); lumiException_ = true; currentLumi_ = HandleLumis::LumiID(run.processHistoryID(), run.runNumber(), ep_.readAndCacheLumi()); if (context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) { assert(context<HandleRuns>().beginRunCalled()); ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi()); } lumiException_ = false; currentLumiEmpty_ = true; }
Definition at line 345 of file EPStates.h.
Referenced by currentLumi(), finalizeLumi(), and setupCurrentLumi().
bool statemachine::HandleLumis::currentLumiEmpty_ [private] |
Definition at line 344 of file EPStates.h.
Referenced by currentLumiEmpty(), finalizeLumi(), markLumiNonEmpty(), and setupCurrentLumi().
Definition at line 342 of file EPStates.h.
Referenced by exit(), finalizeLumi(), markLumiNonEmpty(), setupCurrentLumi(), and ~HandleLumis().
bool statemachine::HandleLumis::exitCalled_ [private] |
Definition at line 343 of file EPStates.h.
Referenced by exit(), and ~HandleLumis().
bool statemachine::HandleLumis::lumiException_ [private] |
Definition at line 346 of file EPStates.h.
Referenced by exit(), finalizeLumi(), markLumiNonEmpty(), setupCurrentLumi(), and ~HandleLumis().