1 #ifndef FWCore_Framework_StreamSchedule_h 2 #define FWCore_Framework_StreamSchedule_h 100 class BranchIDListHelper;
102 class ExceptionCollector;
103 class ExceptionToActionTable;
104 class OutputModuleCommunicator;
105 class ProcessContext;
108 class ModuleRegistry;
109 class TriggerResultInserter;
110 class PathStatusInserter;
111 class EndPathStatusInserter;
112 class PreallocationConfiguration;
116 class TriggerNamesService;
120 template <
typename T>
121 class StreamScheduleSignalSentry {
123 StreamScheduleSignalSentry(
ActivityRegistry*
a,
typename T::Context
const* context) :
124 a_(a), context_(context), allowThrow_(
false) {
125 if (a_) T::preScheduleSignal(a_, context_);
129 if (a_) { T::postScheduleSignal(a_, context_); }
131 if(allowThrow_) {
throw;}
142 typename T::Context
const* context_;
163 std::vector<
edm::propagate_const<std::shared_ptr<EndPathStatusInserter>>>& endPathStatusInserters,
164 std::shared_ptr<ModuleRegistry>,
171 std::shared_ptr<ActivityRegistry> areg,
172 std::shared_ptr<ProcessConfiguration> processConfiguration,
173 bool allowEarlyDelete,
184 template <
typename T>
188 bool cleaningUpAfterException =
false);
201 std::vector<ModuleDescription const*> getAllModuleDescriptions()
const;
204 void availablePaths(std::vector<std::string>& oLabelsToFill)
const;
208 std::vector<std::string>& oLabelsToFill)
const;
210 void moduleDescriptionsInPath(
std::string const& iPathLabel,
211 std::vector<ModuleDescription const*>& descriptions,
212 unsigned int hint)
const;
214 void moduleDescriptionsInEndPath(
std::string const& iEndPathLabel,
215 std::vector<ModuleDescription const*>& descriptions,
216 unsigned int hint)
const;
222 return total_events_;
228 return total_passed_;
234 return totalEvents() - totalEventsPassed();
239 void enableEndPaths(
bool active);
243 bool endPathsEnabled()
const;
250 void clearCounters();
257 return workerManager_.allWorkers();
261 return number_of_unscheduled_modules_;
290 return workerManager_.actionTable();
298 std::exception_ptr finishProcessOneEvent(std::exception_ptr);
305 std::shared_ptr<ProcessConfiguration const> processConfiguration,
307 std::vector<std::string>
const& endPathNames);
311 std::shared_ptr<ProcessConfiguration const> processConfiguration,
313 std::vector<std::string>
const& endPathNames);
317 std::shared_ptr<ProcessConfiguration const> processConfiguration,
319 std::vector<std::string>
const& endPathNames);
321 void addToAllWorkers(
Worker*
w);
323 void resetEarlyDelete();
327 bool allowEarlyDelete);
332 void makePathStatusInserters(
334 std::vector<
edm::propagate_const<std::shared_ptr<EndPathStatusInserter>>>& endPathStatusInserters,
380 reportSvc->reportSkippedEvent(ep.
id().
run(), ep.
id().
event());
383 template <
typename T>
385 typename T::MyPrincipal& ep,
387 bool cleaningUpAfterException) {
390 T::setStreamContext(streamContext_, ep);
394 [
this,iHolder,
id,cleaningUpAfterException,token](std::exception_ptr
const* iPtr)
mutable 397 std::exception_ptr excpt;
403 std::rethrow_exception(excpt);
407 std::ostringstream ost;
409 ost<<
"Processing "<<T::transitionName()<<
" "<<
id;
412 excpt = std::current_exception();
419 T::postScheduleSignal(actReg_.get(), &streamContext_);
422 excpt = std::current_exception();
429 auto task =
make_functor_task(tbb::task::allocate_root(), [
this,doneTask,&ep,&es,cleaningUpAfterException,token] ()
mutable {
431 T::preScheduleSignal(actReg_.get(), &streamContext_);
434 workerManager_.resetAll();
435 for(
auto&
p : end_paths_) {
436 p.runAllModulesAsync<
T>(doneTask, ep, es, streamID_, &streamContext_);
439 for(
auto&
p : trig_paths_) {
440 p.runAllModulesAsync<
T>(doneTask, ep, es, streamID_, &streamContext_);
443 workerManager_.processOneOccurrenceAsync<
T>(doneTask,
444 ep, es, streamID_, &streamContext_, &streamContext_);
447 if(streamID_.value() == 0) {
451 tbb::task::spawn( *task);
453 tbb::task::enqueue( *task);
EventNumber_t event() const
StreamContext const * context_
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
std::shared_ptr< HLTGlobalStatus const > TrigResConstPtr
std::vector< Worker * > Workers
std::vector< int > empty_trig_paths_
roAction_t actions[nactions]
std::vector< edm::propagate_const< WorkerPtr > > pathStatusInserterWorkers_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
int totalEventsFailed() const
unsigned int numberOfUnscheduledModules() const
std::vector< Path > NonTrigPaths
std::shared_ptr< HLTGlobalStatus > TrigResPtr
FunctorTask< F > * make_functor_task(ALLOC &&iAlloc, F f)
volatile bool endpathsAreActive_
std::vector< BranchToCount > earlyDeleteBranchToCount_
EventID const & id() const
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
void reportSkipped(EventPrincipal const &ep) const
edm::propagate_const< WorkerPtr > results_inserter_
ExceptionToActionTable const & actionTable() const
returns the action table
std::shared_ptr< Worker > WorkerPtr
ServiceToken presentToken() const
unsigned int number_of_unscheduled_modules_
WorkerManager workerManager_
std::shared_ptr< ActivityRegistry > actReg_
std::vector< WorkerInPath > PathWorkers
int totalEventsPassed() const
std::vector< int > empty_end_paths_
void doneWaiting(std::exception_ptr iExcept)
StreamID streamID() const
SendTerminationSignalIfException(edm::ActivityRegistry *iReg, edm::StreamContext const *iContext)
StreamContext streamContext_
std::vector< std::string > vstring
std::list< std::string > const & context() const
static ServiceRegistry & instance()
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::vector< Worker * > AllWorkers
std::vector< unsigned int > earlyDeleteHelperToBranchIndicies_
edm::propagate_const< TrigResPtr > results_
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
void processOneStreamAsync(WaitingTaskHolder iTask, typename T::MyPrincipal &principal, EventSetup const &eventSetup, bool cleaningUpAfterException=false)
~SendTerminationSignalIfException()
std::atomic< bool > skippingEvent_
StreamContext const & context() const
std::vector< edm::propagate_const< WorkerPtr > > endPathStatusInserterWorkers_
auto wrap(F iFunc) -> decltype(iFunc())
edm::ActivityRegistry * reg_
TrigResConstPtr results() const
std::vector< Path > TrigPaths
std::vector< EarlyDeleteHelper > earlyDeleteHelpers_
void completedSuccessfully()