CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
statemachine::HandleRuns Class Reference

#include <EPStates.h>

Inheritance diagram for statemachine::HandleRuns:

Public Types

typedef sc::transition< File,
NewInputAndOutputFiles
reactions
 

Public Member Functions

void beginRun (Run const &run)
 
bool beginRunCalled () const
 
void beginRunIfNotDoneAlready ()
 
Run const & currentRun () const
 
void endRun (Run const &run)
 
void exit ()
 
void finalizeRun (Run const &)
 
void finalizeRun ()
 
 HandleRuns (my_context ctx)
 
bool runException () const
 
void setupCurrentRun ()
 
 ~HandleRuns ()
 

Private Attributes

bool beginRunCalled_
 
Run currentRun_
 
edm::IEventProcessorep_
 
bool exitCalled_
 
bool runException_
 

Detailed Description

Definition at line 233 of file EPStates.h.

Member Typedef Documentation

Definition at line 240 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleRuns::HandleRuns ( my_context  ctx)

Definition at line 209 of file EPStates.cc.

209  :
210  my_base(ctx),
211  ep_(context<Machine>().ep()),
212  exitCalled_(false),
213  beginRunCalled_(false),
214  currentRun_(INVALID_RUN),
215  runException_(false) { }
edm::IEventProcessor & ep_
Definition: EPStates.h:252
statemachine::HandleRuns::~HandleRuns ( )

Definition at line 223 of file EPStates.cc.

References ExpressReco_HICollisions_FallBack::e, ep_, cmsCodeRules.cppFunctionSkipper::exception, exitCalled_, cms::Exception::explainSelf(), finalizeRun(), argparse::message, runTheMatrix::msg, and edm::IEventProcessor::setExceptionMessageRuns().

223  {
224  if (!exitCalled_) {
225  try {
226  finalizeRun();
227  }
228  catch (cms::Exception& e) {
229  std::ostringstream message;
230  message << "------------------------------------------------------------\n"
231  << "Another exception was caught while trying to clean up runs after\n"
232  << "the primary exception. We give up trying to clean up runs at\n"
233  << "this point. The description of this additional exception follows:\n"
234  << "cms::Exception\n"
235  << e.explainSelf();
236  std::string msg(message.str());
238  }
239  catch (std::bad_alloc& e) {
240  std::ostringstream message;
241  message << "------------------------------------------------------------\n"
242  << "Another exception was caught while trying to clean up runs\n"
243  << "after the primary exception. We give up trying to clean up runs\n"
244  << "at this point. This additional exception was a\n"
245  << "std::bad_alloc exception thrown inside HandleRuns::finalizeRun.\n"
246  << "The job has probably exhausted the virtual memory available\n"
247  << "to the process.\n";
248  std::string msg(message.str());
250  }
251  catch (std::exception& e) {
252  std::ostringstream message;
253  message << "------------------------------------------------------------\n"
254  << "Another exception was caught while trying to clean up runs after\n"
255  << "the primary exception. We give up trying to clean up runs at\n"
256  << "this point. This additional exception was a\n"
257  << "standard library exception thrown inside HandleRuns::finalizeRun\n"
258  << e.what() << "\n";
259  std::string msg(message.str());
261  }
262  catch (...) {
263  std::ostringstream message;
264  message << "------------------------------------------------------------\n"
265  << "Another exception was caught while trying to clean up runs after\n"
266  << "the primary exception. We give up trying to clean up runs at\n"
267  << "this point. This additional exception was of unknown type and\n"
268  << "thrown inside HandleRuns::finalizeRun\n";
269  std::string msg(message.str());
271  }
272  }
273  }
virtual std::string explainSelf() const
Definition: Exception.cc:56
edm::IEventProcessor & ep_
Definition: EPStates.h:252
string message
Definition: argparse.py:126
virtual void setExceptionMessageRuns(std::string &message)=0

Member Function Documentation

void statemachine::HandleRuns::beginRun ( Run const &  run)

Definition at line 290 of file EPStates.cc.

References edm::IEventProcessor::beginRun(), beginRunCalled_, ep_, and runException_.

Referenced by beginRunIfNotDoneAlready(), and setupCurrentRun().

290  {
291  beginRunCalled_ = true;
292 
293  runException_ = true;
294  ep_.beginRun(run);
295  runException_ = false;
296  }
edm::IEventProcessor & ep_
Definition: EPStates.h:252
virtual void beginRun(statemachine::Run const &run)=0
bool statemachine::HandleRuns::beginRunCalled ( ) const

Definition at line 275 of file EPStates.cc.

References beginRunCalled_.

275 { return beginRunCalled_; }
void statemachine::HandleRuns::beginRunIfNotDoneAlready ( )

Definition at line 322 of file EPStates.cc.

References beginRun(), beginRunCalled_, and currentRun().

322  {
324  }
Run const & currentRun() const
Definition: EPStates.cc:276
void beginRun(Run const &run)
Definition: EPStates.cc:290
Run const & statemachine::HandleRuns::currentRun ( ) const

Definition at line 276 of file EPStates.cc.

References currentRun_.

Referenced by beginRunIfNotDoneAlready(), finalizeRun(), and setupCurrentRun().

276 { return currentRun_; }
void statemachine::HandleRuns::endRun ( Run const &  run)

Definition at line 298 of file EPStates.cc.

References beginRunCalled_, edm::IEventProcessor::endRun(), ep_, and runException_.

Referenced by finalizeRun().

298  {
299  beginRunCalled_ = false;
300 
301  runException_ = true;
302  ep_.endRun(run);
303  runException_ = false;
304  }
edm::IEventProcessor & ep_
Definition: EPStates.h:252
virtual void endRun(statemachine::Run const &run)=0
void statemachine::HandleRuns::exit ( )

Definition at line 217 of file EPStates.cc.

References edm::IEventProcessor::alreadyHandlingException(), ep_, exitCalled_, and finalizeRun().

Referenced by argparse.ArgumentParser::error().

217  {
218  if (ep_.alreadyHandlingException()) return;
219  exitCalled_ = true;
220  finalizeRun();
221  }
edm::IEventProcessor & ep_
Definition: EPStates.h:252
virtual bool alreadyHandlingException() const =0
void statemachine::HandleRuns::finalizeRun ( Run const &  )

Definition at line 306 of file EPStates.cc.

References finalizeRun().

306  {
307  finalizeRun();
308  }
void statemachine::HandleRuns::finalizeRun ( )

Definition at line 310 of file EPStates.cc.

References beginRunCalled_, currentRun(), currentRun_, edm::IEventProcessor::deleteRunFromCache(), endRun(), ep_, runException_, and edm::IEventProcessor::writeRun().

Referenced by exit(), finalizeRun(), statemachine::HandleNewInputFile2::react(), statemachine::ContinueRun1::react(), and ~HandleRuns().

310  {
311 
312  if (runException_) return;
313  runException_ = true;
314 
318  currentRun_ = INVALID_RUN;
319  runException_ = false;
320  }
void endRun(Run const &run)
Definition: EPStates.cc:298
edm::IEventProcessor & ep_
Definition: EPStates.h:252
virtual void deleteRunFromCache(statemachine::Run const &run)=0
Run const & currentRun() const
Definition: EPStates.cc:276
virtual void writeRun(statemachine::Run const &run)=0
bool statemachine::HandleRuns::runException ( ) const

Definition at line 277 of file EPStates.cc.

References runException_.

277 { return runException_; }
void statemachine::HandleRuns::setupCurrentRun ( )

Definition at line 279 of file EPStates.cc.

References beginRun(), currentRun(), currentRun_, statemachine::doNotHandleEmptyRunsAndLumis, ep_, edm::IEventProcessor::readAndCacheRun(), and runException_.

279  {
280 
281  runException_ = true;
283  runException_ = false;
284 
285  if (context<Machine>().emptyRunLumiMode() != doNotHandleEmptyRunsAndLumis) {
286  beginRun(currentRun());
287  }
288  }
edm::IEventProcessor & ep_
Definition: EPStates.h:252
virtual statemachine::Run readAndCacheRun()=0
Run const & currentRun() const
Definition: EPStates.cc:276
void beginRun(Run const &run)
Definition: EPStates.cc:290

Member Data Documentation

bool statemachine::HandleRuns::beginRunCalled_
private

Definition at line 254 of file EPStates.h.

Referenced by beginRun(), beginRunCalled(), beginRunIfNotDoneAlready(), endRun(), and finalizeRun().

Run statemachine::HandleRuns::currentRun_
private

Definition at line 255 of file EPStates.h.

Referenced by currentRun(), finalizeRun(), and setupCurrentRun().

edm::IEventProcessor& statemachine::HandleRuns::ep_
private

Definition at line 252 of file EPStates.h.

Referenced by beginRun(), endRun(), exit(), finalizeRun(), setupCurrentRun(), and ~HandleRuns().

bool statemachine::HandleRuns::exitCalled_
private

Definition at line 253 of file EPStates.h.

Referenced by exit(), and ~HandleRuns().

bool statemachine::HandleRuns::runException_
private

Definition at line 256 of file EPStates.h.

Referenced by beginRun(), endRun(), finalizeRun(), runException(), and setupCurrentRun().