1 #ifndef FWCore_Framework_Worker_h
2 #define FWCore_Framework_Worker_h
53 class ProductHolderIndexHelper;
54 class ProductHolderIndexAndSkipBit;
57 class ProductRegistry;
58 class ThinnedAssociationsHelper;
60 namespace workerhelper {
79 typename T::Context
const* context);
167 unsigned int iNumberOfChildren) = 0;
188 template <
typename T>
189 class ModuleSignalSentry {
192 typename T::Context
const* context,
194 a_(a), context_(context), moduleCallingContext_(moduleCallingContext) {
196 if(a_) T::preModuleSignal(a_, context, moduleCallingContext_);
199 ~ModuleSignalSentry() {
200 if(a_) T::postModuleSignal(a_, context_, moduleCallingContext_);
205 typename T::Context
const* context_;
209 template <
typename T>
210 void exceptionContext(
typename T::MyPrincipal
const&
principal,
212 ModuleCallingContext
const* mcc) {
214 ModuleCallingContext
const* imcc = mcc;
216 std::ostringstream iost;
217 iost <<
"Calling method for unscheduled module "
219 << imcc->moduleDescription()->moduleLabel() <<
"'";
221 imcc = imcc->moduleCallingContext();
224 std::ostringstream iost;
225 iost <<
"Calling method for unscheduled module "
226 << imcc->moduleDescription()->moduleName() <<
"/'"
227 << imcc->moduleDescription()->moduleLabel() <<
"' (probably inside some kind of mixing module)";
229 imcc = imcc->internalContext()->moduleCallingContext();
232 std::ostringstream iost;
233 iost <<
"Calling method for unscheduled module "
234 << imcc->moduleDescription()->moduleName() <<
"/'"
235 << imcc->moduleDescription()->moduleLabel() <<
"'";
237 imcc = imcc->moduleCallingContext();
239 std::ostringstream ost;
241 ost <<
"Calling event method";
248 ost <<
"Calling unknown function";
250 ost <<
" for module " << imcc->moduleDescription()->moduleName() <<
"/'" << imcc->moduleDescription()->moduleLabel() <<
"'";
255 ost <<
"Running path '";
256 ost << imcc->placeInPathContext()->pathContext()->pathName() <<
"'";
260 ost <<
"Processing ";
261 ost << principal.id();
266 namespace workerhelper {
277 return iWorker->
implDo(ep,es, mcc);
290 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
303 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
316 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
329 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
343 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
356 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
370 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
383 ModuleSignalSentry<Arg> cpp(actReg, context, mcc);
389 template <
typename T>
394 typename T::Context
const* context) {
403 case Pass:
return true;
404 case Fail:
return false;
420 for(
auto const& item : items) {
422 bool skipCurrentProcess = item.skipCurrentProcess();
static bool call(Worker *iWorker, StreamID, LuminosityBlockPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
bool doWork(typename T::MyPrincipal &, EventSetup const &c, StreamID stream, ParentContext const &parentContext, typename T::Context const *context)
void pathFinished(EventPrincipal &)
void resetModuleDescription(ModuleDescription const *)
ModuleDescription const & description() const
void setState(State state)
void setEarlyDeleteHelper(EarlyDeleteHelper *iHelper)
ModuleCallingContext const * getTopModuleCallingContext() const
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)=0
OccurrenceTraits< LuminosityBlockPrincipal, BranchActionStreamBegin > Arg
static bool call(Worker *iWorker, StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
OccurrenceTraits< RunPrincipal, BranchActionGlobalEnd > Arg
virtual void implRespondToCloseInputFile(FileBlock const &fb)=0
std::shared_ptr< ActivityRegistry > actReg_
std::string const & moduleName() const
std::string const & category() const
exception_actions::ActionCodes find(const std::string &category) const
unsigned int ProductHolderIndex
ActivityRegistry * activityRegistry()
void beginStream(StreamID id, StreamContext &streamContext)
virtual bool implDoStreamBegin(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
virtual void implPreForkReleaseResources()=0
virtual std::string workerType() const =0
virtual void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const =0
ExceptionToActionTable const * actions_
void setActivityRegistry(std::shared_ptr< ActivityRegistry > areg)
EarlyDeleteHelper * earlyDeleteHelper_
ModuleCallingContext moduleCallingContext_
static bool call(Worker *iWorker, StreamID id, RunPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
virtual bool implDoBegin(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)=0
Worker & operator=(Worker const &)=delete
virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)=0
virtual bool implDo(EventPrincipal &, EventSetup const &c, ModuleCallingContext const *mcc)=0
PathContext const * pathContext() const
OccurrenceTraits< RunPrincipal, BranchActionGlobalBegin > Arg
ModuleDescription const * descPtr() const
ModuleDescription const * moduleDescription() const
void registerThinnedAssociations(ProductRegistry const ®istry, ThinnedAssociationsHelper &helper)
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
OccurrenceTraits< LuminosityBlockPrincipal, BranchActionGlobalEnd > Arg
Worker(ModuleDescription const &iMD, ExceptionToActionTable const *iActions)
OccurrenceTraits< LuminosityBlockPrincipal, BranchActionStreamEnd > Arg
static bool call(Worker *iWorker, StreamID, LuminosityBlockPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
static bool call(Worker *iWorker, StreamID id, RunPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
virtual void implEndJob()=0
virtual std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const =0
virtual void modulesDependentUpon(std::vector< const char * > &oModuleLabels) const =0
void postForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
virtual Types moduleType() const =0
OccurrenceTraits< EventPrincipal, BranchActionStreamBegin > Arg
void postDoEvent(EventPrincipal &)
OccurrenceTraits< RunPrincipal, BranchActionStreamBegin > Arg
virtual void implBeginJob()=0
void respondToOpenInputFile(FileBlock const &fb)
virtual void itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const =0
void addContext(std::string const &context)
virtual void implBeginStream(StreamID)=0
virtual void implEndStream(StreamID)=0
void respondToCloseInputFile(FileBlock const &fb)
void preForkReleaseResources()
std::shared_ptr< cms::Exception > cached_exception_
void endStream(StreamID id, StreamContext &streamContext)
static bool call(Worker *iWorker, StreamID, EventPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
auto wrap(F iFunc) -> decltype(iFunc())
virtual bool implDoEnd(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
OccurrenceTraits< LuminosityBlockPrincipal, BranchActionGlobalBegin > Arg
virtual void implRespondToOpenInputFile(FileBlock const &fb)=0
static bool call(Worker *iWorker, StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
PlaceInPathContext const * placeInPathContext() const
OccurrenceTraits< RunPrincipal, BranchActionStreamEnd > Arg
virtual bool implDoStreamEnd(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)=0
static bool call(Worker *iWorker, StreamID, RunPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)
static bool call(Worker *iWorker, StreamID, RunPrincipal &ep, EventSetup const &es, ActivityRegistry *actReg, ModuleCallingContext const *mcc, Arg::Context const *context)