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,
185 template <
typename T>
190 bool cleaningUpAfterException =
false);
203 std::vector<ModuleDescription const*> getAllModuleDescriptions()
const;
206 void availablePaths(std::vector<std::string>& oLabelsToFill)
const;
210 std::vector<std::string>& oLabelsToFill)
const;
212 void moduleDescriptionsInPath(
std::string const& iPathLabel,
213 std::vector<ModuleDescription const*>& descriptions,
214 unsigned int hint)
const;
216 void moduleDescriptionsInEndPath(
std::string const& iEndPathLabel,
217 std::vector<ModuleDescription const*>& descriptions,
218 unsigned int hint)
const;
224 return total_events_;
230 return total_passed_;
236 return totalEvents() - totalEventsPassed();
241 void enableEndPaths(
bool active);
245 bool endPathsEnabled()
const;
252 void clearCounters();
259 return workerManager_.allWorkers();
263 return number_of_unscheduled_modules_;
292 return workerManager_.actionTable();
300 std::exception_ptr finishProcessOneEvent(std::exception_ptr);
307 std::shared_ptr<ProcessConfiguration const> processConfiguration,
309 std::vector<std::string>
const& endPathNames);
313 std::shared_ptr<ProcessConfiguration const> processConfiguration,
315 std::vector<std::string>
const& endPathNames);
319 std::shared_ptr<ProcessConfiguration const> processConfiguration,
321 std::vector<std::string>
const& endPathNames);
323 void addToAllWorkers(
Worker*
w);
325 void resetEarlyDelete();
329 bool allowEarlyDelete);
334 void makePathStatusInserters(
336 std::vector<
edm::propagate_const<std::shared_ptr<EndPathStatusInserter>>>& endPathStatusInserters,
382 reportSvc->reportSkippedEvent(ep.
id().
run(), ep.
id().
event());
385 template <
typename T>
387 typename T::MyPrincipal& ep,
390 bool cleaningUpAfterException) {
391 T::setStreamContext(streamContext_, ep);
395 [
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;
413 excpt = std::current_exception();
422 T::postScheduleSignal(actReg_.get(), &streamContext_);
425 excpt = std::current_exception();
435 T::preScheduleSignal(actReg_.get(), &streamContext_);
437 workerManager_.resetAll();
439 h.doneWaiting(std::current_exception());
443 for(
auto&
p : end_paths_) {
444 p.runAllModulesAsync<
T>(doneTask, ep, es, token, streamID_, &streamContext_);
447 for(
auto&
p : trig_paths_) {
448 p.runAllModulesAsync<
T>(doneTask, ep, es, token, streamID_, &streamContext_);
451 workerManager_.processOneOccurrenceAsync<
T>(doneTask,
452 ep, es, token, streamID_, &streamContext_, &streamContext_);
455 if(streamID_.value() == 0) {
459 tbb::task::spawn( *task);
461 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_
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)
void processOneStreamAsync(WaitingTaskHolder iTask, typename T::MyPrincipal &principal, EventSetup const &eventSetup, ServiceToken const &token, bool cleaningUpAfterException=false)
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
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
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)
~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()