Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Access PathsAndConsumesOfModules from new signal #47467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion EventFilter/Utilities/interface/EvFDaqDirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class GlobalContext;
class StreamID;

namespace edm {
class PathsAndConsumesOfModulesBase;
class ProcessContext;
} // namespace edm

Expand Down
4 changes: 1 addition & 3 deletions EventFilter/Utilities/interface/FastMonitoringService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#include <filesystem>

#include "EventFilter/Utilities/interface/FastMonitoringService.h"

#include <string>
#include <vector>
#include <map>
Expand Down Expand Up @@ -181,7 +179,7 @@ namespace evf {

void preallocate(edm::service::SystemBounds const&);
void jobFailure();
void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const& pc);
void preBeginJob(edm::ProcessContext const& pc);

void preModuleBeginJob(edm::ModuleDescription const&);
void postBeginJob();
Expand Down
3 changes: 1 addition & 2 deletions EventFilter/Utilities/src/FastMonitoringService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "FWCore/Utilities/interface/UnixSignalHandlers.h"

#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
#include "FWCore/ServiceRegistry/interface/PathsAndConsumesOfModulesBase.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
Expand Down Expand Up @@ -318,7 +317,7 @@ namespace evf {
//start concurrency tracking
}

void FastMonitoringService::preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const& pc) {
void FastMonitoringService::preBeginJob(edm::ProcessContext const& pc) {
// FIND RUN DIRECTORY
// The run dir should be set via the configuration of EvFDaqDirector
if (tbbConcurrencyTracker_)
Expand Down
1 change: 0 additions & 1 deletion FWCore/Framework/interface/GlobalSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ namespace edm {
void beginJob(ProductRegistry const&,
eventsetup::ESRecordsToProductResolverIndices const&,
ProcessBlockHelperBase const&,
PathsAndConsumesOfModulesBase const&,
ProcessContext const&);
void endJob(ExceptionCollector& collector);

Expand Down
1 change: 0 additions & 1 deletion FWCore/Framework/interface/Schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ namespace edm {
void beginJob(ProductRegistry const&,
eventsetup::ESRecordsToProductResolverIndices const&,
ProcessBlockHelperBase const&,
PathsAndConsumesOfModulesBase const&,
ProcessContext const&);
void endJob(ExceptionCollector& collector);
void sendFwkSummaryToMessageLogger() const;
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,7 @@ namespace edm {
// after they all complete.
std::exception_ptr firstException;
CMS_SA_ALLOW try {
schedule_->beginJob(
*preg_, esRecordsToProductResolverIndices, *processBlockHelper_, pathsAndConsumesOfModules, processContext_);
schedule_->beginJob(*preg_, esRecordsToProductResolverIndices, *processBlockHelper_, processContext_);
} catch (...) {
firstException = std::current_exception();
}
Expand Down
5 changes: 1 addition & 4 deletions FWCore/Framework/src/GlobalSchedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ namespace edm {
void GlobalSchedule::beginJob(ProductRegistry const& iRegistry,
eventsetup::ESRecordsToProductResolverIndices const& iESIndices,
ProcessBlockHelperBase const& processBlockHelperBase,
PathsAndConsumesOfModulesBase const& pathsAndConsumesOfModules,
ProcessContext const& processContext) {
GlobalContext globalContext(GlobalContext::Transition::kBeginJob, processContext_);
unsigned int const managerIndex =
Expand All @@ -107,9 +106,7 @@ namespace edm {
std::exception_ptr exceptionPtr;
CMS_SA_ALLOW try {
try {
convertException::wrap([this, &pathsAndConsumesOfModules, &processContext]() {
actReg_->preBeginJobSignal_(pathsAndConsumesOfModules, processContext);
});
convertException::wrap([this, &processContext]() { actReg_->preBeginJobSignal_(processContext); });
} catch (cms::Exception& ex) {
exceptionContext(ex, globalContext, "Handling pre signal, likely in a service function");
throw;
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Framework/src/Schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,8 @@ namespace edm {
void Schedule::beginJob(ProductRegistry const& iRegistry,
eventsetup::ESRecordsToProductResolverIndices const& iESIndices,
ProcessBlockHelperBase const& processBlockHelperBase,
PathsAndConsumesOfModulesBase const& pathsAndConsumesOfModules,
ProcessContext const& processContext) {
globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase, pathsAndConsumesOfModules, processContext);
globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase, processContext);
}

void Schedule::beginStream(unsigned int streamID) {
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Framework/src/SubProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ namespace edm {

std::exception_ptr firstException;
CMS_SA_ALLOW try {
schedule_->beginJob(
*preg_, esp_->recordsToResolverIndices(), *processBlockHelper_, *pathsAndConsumesOfModules_, processContext_);
schedule_->beginJob(*preg_, esp_->recordsToResolverIndices(), *processBlockHelper_, processContext_);
} catch (...) {
firstException = std::current_exception();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace edmtest {
public:
PathsAndConsumesOfModulesTestService(edm::ParameterSet const& pset, edm::ActivityRegistry& iRegistry)
: modulesConsumes_(pset.getParameter<decltype(modulesConsumes_)>("modulesAndConsumes")) {
iRegistry.watchPreBeginJob(this, &PathsAndConsumesOfModulesTestService::preBeginJob);
iRegistry.watchLookupInitializationComplete(this,
&PathsAndConsumesOfModulesTestService::lookupInitializationComplete);
}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand All @@ -29,7 +30,8 @@ namespace edmtest {
descriptions.setComment("This service is intended to be used in framework tests.");
}

void preBeginJob(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes, edm::ProcessContext const&) const {
void lookupInitializationComplete(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes,
edm::ProcessContext const&) const {
auto const& allModules = pathsAndConsumes.allModules();
for (auto const& moduleToCheck : modulesConsumes_) {
auto found =
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Integration/plugins/TestServiceOne.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace edmtest {
descriptions.add("TestServiceOne", desc);
}

void TestServiceOne::preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&) {
void TestServiceOne::preBeginJob(edm::ProcessContext const&) {
++nPreBeginJob_;
if (verbose_) {
edm::LogAbsolute out("TestServiceOne");
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Integration/plugins/TestServiceOne.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace edmtest {

static void fillDescriptions(edm::ConfigurationDescriptions&);

void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
void preBeginJob(edm::ProcessContext const&);
void postBeginJob();
void preEndJob();
void postEndJob();
Expand Down
3 changes: 1 addition & 2 deletions FWCore/PrescaleService/interface/PrescaleService.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace edm {
class ActivityRegistry;
class ConfigurationDescriptions;
class PathsAndConsumesOfModulesBase;
class ProcessContext;

namespace service {
Expand Down Expand Up @@ -46,7 +45,7 @@ namespace edm {
//
// private member functions
//
void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&);
void preBeginJob(ProcessContext const&);
void postBeginJob();

//
Expand Down
2 changes: 1 addition & 1 deletion FWCore/PrescaleService/src/PrescaleService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace edm {

// member functions

void PrescaleService::preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const& processContext) {
void PrescaleService::preBeginJob(ProcessContext const& processContext) {
if (!processParameterSetID_.isValid()) {
processParameterSetID_ = processContext.parameterSetID();
}
Expand Down
4 changes: 2 additions & 2 deletions FWCore/ServiceRegistry/interface/ActivityRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ namespace edm {
}
AR_WATCH_USING_METHOD_2(watchEventSetupConfiguration)

typedef signalslot::Signal<void(PathsAndConsumesOfModulesBase const&, ProcessContext const&)> PreBeginJob;
typedef signalslot::Signal<void(ProcessContext const&)> PreBeginJob;
///signal is emitted before all modules have gotten their beginJob called
PreBeginJob preBeginJobSignal_;
///convenience function for attaching to signal
void watchPreBeginJob(PreBeginJob::slot_type const& iSlot) { preBeginJobSignal_.connect(iSlot); }
AR_WATCH_USING_METHOD_2(watchPreBeginJob)
AR_WATCH_USING_METHOD_1(watchPreBeginJob)

typedef signalslot::Signal<void()> PostBeginJob;
///signal is emitted after all modules have gotten their beginJob called
Expand Down
1 change: 0 additions & 1 deletion FWCore/Services/plugins/CheckTransitions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ namespace edm {

void preallocate(service::SystemBounds const&);

void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&);
void postEndJob();

void preOpenFile(std::string const&);
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Services/plugins/CondorStatusUpdater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace edm {
void eventPost(StreamContext const &iContext);
void lumiPost(GlobalContext const &);
void runPost(GlobalContext const &);
void beginPre(PathsAndConsumesOfModulesBase const &, ProcessContext const &processContext);
void beginPre(ProcessContext const &processContext);
void beginPost();
void endPost();
void filePost(std::string const &);
Expand Down Expand Up @@ -150,7 +150,7 @@ void CondorStatusService::filePost(std::string const & /*lfn*/) {
update();
}

void CondorStatusService::beginPre(PathsAndConsumesOfModulesBase const &, ProcessContext const &processContext) {
void CondorStatusService::beginPre(ProcessContext const &processContext) {
secondUpdate();
if (!m_processParameterSetID.isValid()) {
m_processParameterSetID = processContext.parameterSetID();
Expand Down
15 changes: 4 additions & 11 deletions FWCore/Services/plugins/DependencyGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class DependencyGraph {
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

void preSourceConstruction(ModuleDescription const &);
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &);
void postBeginJob();
void lookupInitializationComplete(PathsAndConsumesOfModulesBase const &, ProcessContext const &);

private:
bool highlighted(std::string const &module) { return (m_highlightModules.find(module) != m_highlightModules.end()); }
Expand Down Expand Up @@ -171,8 +170,7 @@ DependencyGraph::DependencyGraph(ParameterSet const &config, ActivityRegistry &r
m_showPathDependencies(config.getUntrackedParameter<bool>("showPathDependencies")),
m_initialized(false) {
registry.watchPreSourceConstruction(this, &DependencyGraph::preSourceConstruction);
registry.watchPreBeginJob(this, &DependencyGraph::preBeginJob);
registry.watchPostBeginJob(this, &DependencyGraph::postBeginJob);
registry.watchLookupInitializationComplete(this, &DependencyGraph::lookupInitializationComplete);
}

// adaptor to use range-based for loops with boost::graph edges(...) and vertices(...) functions
Expand Down Expand Up @@ -204,8 +202,8 @@ void DependencyGraph::preSourceConstruction(ModuleDescription const &module) {
attributes["fillcolor"] = highlighted(module.moduleLabel()) ? "lightgreen" : "white";
}

void DependencyGraph::preBeginJob(PathsAndConsumesOfModulesBase const &pathsAndConsumes,
ProcessContext const &context) {
void DependencyGraph::lookupInitializationComplete(PathsAndConsumesOfModulesBase const &pathsAndConsumes,
ProcessContext const &context) {
// if the Service is not in the main Process do not do anything
if (context.isSubProcess() and not m_initialized) {
edm::LogError("DependencyGraph") << "You have requested an instance of the DependencyGraph Service in the \""
Expand Down Expand Up @@ -398,11 +396,6 @@ void DependencyGraph::preBeginJob(PathsAndConsumesOfModulesBase const &pathsAndC
previous = module;
}
}
}

void DependencyGraph::postBeginJob() {
if (not m_initialized)
return;

// remove the nodes corresponding to the modules that have been removed from the process
for (int i = boost::num_vertices(m_graph) - 1; i > 1; --i) {
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Services/plugins/Timing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace edm {
double getTotalCPU() const override;

private:
void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&);
void preBeginJob(ProcessContext const&);
void beginProcessing();
void postEndJob();

Expand Down Expand Up @@ -438,7 +438,7 @@ namespace edm {
descriptions.setComment("This service reports the time it takes to run each module in a job.");
}

void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) {
void Timing::preBeginJob(ProcessContext const& pc) {
if (pc.isSubProcess()) {
++nSubProcesses_;
} else {
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Services/plugins/Tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace edm {

void preallocate(service::SystemBounds const&);

void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&);
void preBeginJob(ProcessContext const&);
void postBeginJob();
void preEndJob();
void postEndJob();
Expand Down Expand Up @@ -546,7 +546,7 @@ void Tracer::preallocate(service::SystemBounds const& bounds) {
<< bounds.maxNumberOfStreams() << " streams";
}

void Tracer::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) {
void Tracer::preBeginJob(ProcessContext const& pc) {
LogAbsolute out("Tracer");
out << TimeStamper(printTimestamps_) << indention_ << " starting: begin job";
}
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Services/plugins/tracer_setupFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ namespace edm::service::tracer {
moduleCtrDtrPtr,
sourceCtrPtr,
beginTime,
beginTracer](auto&, auto&) mutable {
beginTracer](auto&) mutable {
{
std::ostringstream oss;
moduleIdToLabel(oss, *moduleLabelsPtr, 'M', "EDModule ID", "Module label");
Expand Down
11 changes: 1 addition & 10 deletions FWCore/TestProcessor/src/TestProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "FWCore/Framework/interface/ProcessBlockPrincipal.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Framework/interface/HistoryAppender.h"
#include "FWCore/Framework/interface/PathsAndConsumesOfModules.h"
#include "FWCore/Framework/interface/RunPrincipal.h"
#include "FWCore/Framework/interface/ESRecordsToProductResolverIndices.h"
#include "FWCore/Framework/interface/EventSetupsController.h"
Expand Down Expand Up @@ -429,19 +428,11 @@ namespace edm {
preallocations_.numberOfThreads());
actReg_->preallocateSignal_(bounds);
schedule_->convertCurrentProcessAlias(processConfiguration_->processName());
PathsAndConsumesOfModules pathsAndConsumesOfModules;

//The code assumes only modules make data in the current process
// Since the test os also allowed to do so, it can lead to problems.
//pathsAndConsumesOfModules.initialize(schedule_.get(), preg_);

espController_->finishConfiguration();
actReg_->eventSetupConfigurationSignal_(esp_->recordsToResolverIndices(), processContext_);
//NOTE: this may throw
//checkForModuleDependencyCorrectness(pathsAndConsumesOfModules, false);

schedule_->beginJob(
*preg_, esp_->recordsToResolverIndices(), *processBlockHelper_, pathsAndConsumesOfModules, processContext_);
schedule_->beginJob(*preg_, esp_->recordsToResolverIndices(), *processBlockHelper_, processContext_);

for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
schedule_->beginStream(i);
Expand Down
4 changes: 2 additions & 2 deletions HLTrigger/Timer/interface/ProcessCallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class ProcessCallGraph {
// to be called from preSourceConstruction(...)
void preSourceConstruction(edm::ModuleDescription const &);

// to be called from preBeginJob(...)
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &);
// to be called from lookupInitializationComplete(...)
void lookupInitializationComplete(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &);

// number of modules stored in the call graph
unsigned int size() const;
Expand Down
12 changes: 4 additions & 8 deletions HLTrigger/Timer/plugins/FastTimerService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,7 @@ FastTimerService::FastTimerService(const edm::ParameterSet& config, edm::Activit

// register EDM call backs
registry.watchPreallocate(this, &FastTimerService::preallocate);
registry.watchPreBeginJob(this, &FastTimerService::preBeginJob);
registry.watchPostBeginJob(this, &FastTimerService::postBeginJob);
registry.watchLookupInitializationComplete(this, &FastTimerService::lookupInitializationComplete);
registry.watchPostEndJob(this, &FastTimerService::postEndJob);
registry.watchPreGlobalBeginRun(this, &FastTimerService::preGlobalBeginRun);
//registry.watchPostGlobalBeginRun( this, & FastTimerService::postGlobalBeginRun );
Expand Down Expand Up @@ -990,12 +989,9 @@ void FastTimerService::preSourceConstruction(edm::ModuleDescription const& modul
callgraph_.preSourceConstruction(module);
}

void FastTimerService::preBeginJob(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes,
edm::ProcessContext const& context) {
callgraph_.preBeginJob(pathsAndConsumes, context);
}

void FastTimerService::postBeginJob() {
void FastTimerService::lookupInitializationComplete(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes,
edm::ProcessContext const& context) {
callgraph_.lookupInitializationComplete(pathsAndConsumes, context);
unsigned int modules = callgraph_.size();

// module highlights
Expand Down
3 changes: 1 addition & 2 deletions HLTrigger/Timer/plugins/FastTimerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class FastTimerService : public tbb::task_scheduler_observer {

void preallocate(edm::service::SystemBounds const&);

void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
void postBeginJob();
void lookupInitializationComplete(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);

void postEndJob();

Expand Down
4 changes: 2 additions & 2 deletions HLTrigger/Timer/src/ProcessCallGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void ProcessCallGraph::preSourceConstruction(edm::ModuleDescription const& modul
// FIXME
// - check that all module ids are valid (e.g. subprocesses are not being added in
// the wrong order)
void ProcessCallGraph::preBeginJob(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes,
edm::ProcessContext const& context) {
void ProcessCallGraph::lookupInitializationComplete(edm::PathsAndConsumesOfModulesBase const& pathsAndConsumes,
edm::ProcessContext const& context) {
unsigned int pid = registerProcess(context);

// check that the Source has already been added
Expand Down
Loading