CMS 3D CMS Logo

Path.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Framework/src/Path.h"
00003 #include "FWCore/Framework/interface/Actions.h"
00004 #include "FWCore/Utilities/interface/Algorithms.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 
00007 #include <algorithm>
00008 #include "boost/bind.hpp"
00009 
00010 namespace edm {
00011   Path::Path(int bitpos, std::string const& path_name,
00012              WorkersInPath const& workers,
00013              TrigResPtr trptr,
00014              ParameterSet const&,
00015              ActionTable& actions,
00016              boost::shared_ptr<ActivityRegistry> areg,
00017              bool isEndPath):
00018     stopwatch_(new RunStopwatch::StopwatchPointer::element_type),
00019     timesRun_(),
00020     timesPassed_(),
00021     timesFailed_(),
00022     timesExcept_(),
00023     state_(edm::hlt::Ready),
00024     bitpos_(bitpos),
00025     name_(path_name),
00026     trptr_(trptr),
00027     actReg_(areg),
00028     act_table_(&actions),
00029     workers_(workers),
00030     isEndPath_(isEndPath)
00031   {
00032   }
00033   
00034   bool
00035   Path::handleWorkerFailure(cms::Exception const& e,
00036                             int nwrwue, bool isEvent) {
00037     bool should_continue = true;
00038 
00039     // there is no support as of yet for specific paths having
00040     // different exception behavior
00041     
00042     // If not processing an event, always rethrow.
00043     actions::ActionCodes action = (isEvent ? act_table_->find(e.rootCause()) : actions::Rethrow);
00044     assert (action != actions::FailModule);
00045     switch(action) {
00046       case actions::FailPath: {
00047           should_continue = false;
00048           LogWarning(e.category())
00049             << "Failing path " << name_
00050             << ", due to exception, message:\n"
00051             << e.what() << "\n";
00052           break;
00053       }
00054       default: {
00055           if (isEvent) ++timesExcept_;
00056           state_ = edm::hlt::Exception;
00057           recordStatus(nwrwue, isEvent);
00058           throw edm::Exception(errors::ScheduleExecutionFailure,
00059               "ProcessingStopped", e)
00060               << "Exception going through path " << name_ << "\n";
00061       }
00062     }
00063 
00064     return should_continue;
00065   }
00066 
00067   void
00068   Path::recordUnknownException(int nwrwue, bool isEvent) {
00069     LogError("PassingThrough")
00070       << "Exception passing through path " << name_ << "\n";
00071     if (isEvent) ++timesExcept_;
00072     state_ = edm::hlt::Exception;
00073     recordStatus(nwrwue, isEvent);
00074   }
00075 
00076   void
00077   Path::recordStatus(int nwrwue, bool isEvent) {
00078     if(isEvent) {
00079       (*trptr_)[bitpos_]=HLTPathStatus(state_, nwrwue);    
00080     }
00081   }
00082 
00083   void
00084   Path::updateCounters(bool success, bool isEvent) {
00085     if (success) {
00086       if (isEvent) ++timesPassed_;
00087       state_ = edm::hlt::Pass;
00088     } else {
00089       if(isEvent) ++timesFailed_;
00090       state_ = edm::hlt::Fail;
00091     }
00092   }
00093 
00094   void
00095   Path::clearCounters() {
00096     timesRun_ = timesPassed_ = timesFailed_ = timesExcept_ = 0;
00097     for_all(workers_, boost::bind(&WorkerInPath::clearCounters, _1));
00098   }
00099 
00100 
00101 }

Generated on Tue Jun 9 17:36:11 2009 for CMSSW by  doxygen 1.5.4