1 #ifndef FWCore_Framework_Worker_h
2 #define FWCore_Framework_Worker_h
35 #include "boost/shared_ptr.hpp"
36 #include "boost/utility.hpp"
47 class Worker :
private boost::noncopyable {
125 unsigned int iNumberOfChildren) = 0;
145 template <
typename T>
146 class ModuleSignalSentry {
149 if(a_) T::preModuleSignal(a_, md_);
151 ~ModuleSignalSentry() {
152 if(a_) T::postModuleSignal(a_, md_);
159 template <
typename T>
160 void exceptionContext(
typename T::MyPrincipal
const&
principal,
162 CurrentProcessingContext
const* cpc) {
163 std::ostringstream ost;
165 ost <<
"Calling event method";
167 else if (T::begin_ && T::branchType_ ==
InRun) {
168 ost <<
"Calling beginRun";
170 else if (T::begin_ && T::branchType_ ==
InLumi) {
171 ost <<
"Calling beginLuminosityBlock";
173 else if (!T::begin_ && T::branchType_ ==
InLumi) {
174 ost <<
"Calling endLuminosityBlock";
176 else if (!T::begin_ && T::branchType_ ==
InRun) {
177 ost <<
"Calling endRun";
181 ost <<
"Calling unknown function";
183 if (cpc && cpc->moduleDescription()) {
184 ost <<
" for module " << cpc->moduleDescription()->
moduleName() <<
"/'" << cpc->moduleDescription()->moduleLabel() <<
"'";
188 ost <<
"Running path '";
189 if (cpc && cpc->pathName()) {
190 ost << *cpc->pathName() <<
"'";
197 ost <<
"Processing ";
198 ost << principal.id();
203 template <
typename T>
220 case Pass:
return true;
221 case Fail:
return false;
232 ModuleSignalSentry<T> cpp(
actReg_.get(),
md_);
276 exceptionContext<T>(ep, ex, cpc);
void pathFinished(EventPrincipal &)
ModuleDescription const & description() const
void setEarlyDeleteHelper(EarlyDeleteHelper *iHelper)
bool isEndPath() const
Return true if the path is an end path, and false otherwise.
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)=0
virtual void implRespondToOpenOutputFiles(FileBlock const &fb)=0
boost::shared_ptr< ActivityRegistry > actReg_
void setActivityRegistry(boost::shared_ptr< ActivityRegistry > areg)
virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
void respondToOpenOutputFiles(FileBlock const &fb)
std::string const & moduleName() const
std::string const & category() const
virtual void implPreForkReleaseResources()=0
virtual std::string workerType() const =0
virtual bool implDoEnd(EventPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc)=0
std::pair< double, double > timeCpuReal() const
EarlyDeleteHelper * earlyDeleteHelper_
bool isUnscheduled() const
Returns true if the module is being called via unscheduled execution.
virtual bool implDoBegin(EventPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc)=0
boost::shared_ptr< CPUTimer > StopwatchPointer
virtual void implRespondToCloseOutputFiles(FileBlock const &fb)=0
void stdToEDM(std::exception const &e)
ModuleDescription const * descPtr() const
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
virtual void implEndJob()=0
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
void postDoEvent(EventPrincipal &)
void respondToCloseOutputFiles(FileBlock const &fb)
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
boost::shared_ptr< cms::Exception > cached_exception_
virtual void implBeginJob()=0
void respondToOpenInputFile(FileBlock const &fb)
void addContext(std::string const &context)
ActionTable const * actions_
void respondToCloseInputFile(FileBlock const &fb)
Worker(ModuleDescription const &iMD, WorkerParams const &iWP)
void preForkReleaseResources()
RunStopwatch::StopwatchPointer stopwatch_
actions::ActionCodes find(const std::string &category) const
bool doWork(typename T::MyPrincipal &, EventSetup const &c, CurrentProcessingContext const *cpc, CPUTimer *const timer)
virtual void implRespondToOpenInputFile(FileBlock const &fb)=0