Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add warning that lists legacy modules if any are configured. #34577

Merged
merged 4 commits into from
Jul 27, 2021
Merged
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: 1 addition & 0 deletions FWCore/Framework/interface/EventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ namespace edm {
std::shared_ptr<EDLooperBase>& looper() { return get_underlying_safe(looper_); }

void warnAboutModulesRequiringLuminosityBLockSynchronization() const;
void warnAboutLegacyModules() const;
//------------------------------------------------------------------
//
// Data members below.
Expand Down
17 changes: 17 additions & 0 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ namespace edm {
if (preallocations_.numberOfLuminosityBlocks() > 1) {
warnAboutModulesRequiringLuminosityBLockSynchronization();
}
warnAboutLegacyModules();

//NOTE: This implementation assumes 'Job' means one call
// the EventProcessor::run
// If it really means once per 'application' then this code will
Expand Down Expand Up @@ -2100,4 +2102,19 @@ namespace edm {
}
}
}

void EventProcessor::warnAboutLegacyModules() const {
std::unique_ptr<LogSystem> s;
for (auto worker : schedule_->allWorkers()) {
if (worker->moduleConcurrencyType() == Worker::kLegacy) {
if (not s) {
s = std::make_unique<LogSystem>("LegacyModules");
(*s) << "The following legacy modules are configured. Support for legacy modules\n"
"is going to end soon. These modules need to be converted to have type\n"
"edm::global, edm::stream, edm::one, or in rare cases edm::limited.";
}
(*s) << "\n " << worker->description()->moduleName() << " " << worker->description()->moduleLabel();
}
}
}
} // namespace edm
2 changes: 2 additions & 0 deletions FWCore/Framework/src/Worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace edm {
public:
enum State { Ready, Pass, Fail, Exception };
enum Types { kAnalyzer, kFilter, kProducer, kOutputModule };
enum ConcurrencyTypes { kGlobal, kLimited, kOne, kStream, kLegacy };
struct TaskQueueAdaptor {
SerialTaskQueueChain* serial_ = nullptr;
LimitedTaskQueue* limited_ = nullptr;
Expand Down Expand Up @@ -214,6 +215,7 @@ namespace edm {
virtual std::vector<ConsumesInfo> consumesInfo() const = 0;

virtual Types moduleType() const = 0;
virtual ConcurrencyTypes moduleConcurrencyType() const = 0;

void clearCounters() {
timesRun_.store(0, std::memory_order_release);
Expand Down
76 changes: 76 additions & 0 deletions FWCore/Framework/src/WorkerT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,82 @@ namespace edm {
return Worker::kAnalyzer;
}

template <>
Worker::ConcurrencyTypes WorkerT<EDAnalyzer>::moduleConcurrencyType() const {
return Worker::kLegacy;
}
template <>
Worker::ConcurrencyTypes WorkerT<EDProducer>::moduleConcurrencyType() const {
return Worker::kLegacy;
}
template <>
Worker::ConcurrencyTypes WorkerT<EDFilter>::moduleConcurrencyType() const {
return Worker::kLegacy;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::one::EDProducerBase>::moduleConcurrencyType() const {
return Worker::kOne;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::one::EDFilterBase>::moduleConcurrencyType() const {
return Worker::kOne;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::one::EDAnalyzerBase>::moduleConcurrencyType() const {
return Worker::kOne;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::one::OutputModuleBase>::moduleConcurrencyType() const {
return Worker::kOne;
}

template <>
Worker::ConcurrencyTypes WorkerT<edm::global::EDProducerBase>::moduleConcurrencyType() const {
return Worker::kGlobal;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::global::EDFilterBase>::moduleConcurrencyType() const {
return Worker::kGlobal;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::global::EDAnalyzerBase>::moduleConcurrencyType() const {
return Worker::kGlobal;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::global::OutputModuleBase>::moduleConcurrencyType() const {
return Worker::kGlobal;
}

template <>
Worker::ConcurrencyTypes WorkerT<edm::limited::EDProducerBase>::moduleConcurrencyType() const {
return Worker::kLimited;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::limited::EDFilterBase>::moduleConcurrencyType() const {
return Worker::kLimited;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::limited::EDAnalyzerBase>::moduleConcurrencyType() const {
return Worker::kLimited;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::limited::OutputModuleBase>::moduleConcurrencyType() const {
return Worker::kLimited;
}

template <>
Worker::ConcurrencyTypes WorkerT<edm::stream::EDProducerAdaptorBase>::moduleConcurrencyType() const {
return Worker::kStream;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::stream::EDFilterAdaptorBase>::moduleConcurrencyType() const {
return Worker::kStream;
}
template <>
Worker::ConcurrencyTypes WorkerT<edm::stream::EDAnalyzerAdaptorBase>::moduleConcurrencyType() const {
return Worker::kStream;
}

//Explicitly instantiate our needed templates to avoid having the compiler
// instantiate them in all of our libraries
template class WorkerT<EDProducer>;
Expand Down
1 change: 1 addition & 0 deletions FWCore/Framework/src/WorkerT.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace edm {
}

Types moduleType() const override;
ConcurrencyTypes moduleConcurrencyType() const override;

bool wantsProcessBlocks() const final;
bool wantsInputProcessBlocks() const final;
Expand Down
7 changes: 4 additions & 3 deletions FWCore/Integration/test/run_TestGetBy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ pushd ${LOCAL_TMP_DIR}

echo "testGetBy1"
cmsRun -p ${LOCAL_TEST_DIR}/${test}1_cfg.py > testGetBy1.log 2>/dev/null || die "cmsRun ${test}1_cfg.py" $?
diff ${LOCAL_TEST_DIR}/unit_test_outputs/testGetBy1.log testGetBy1.log || die "comparing testGetBy1.log" $?
grep -v "LegacyModules" testGetBy1.log > testGetBy1_1.log
diff ${LOCAL_TEST_DIR}/unit_test_outputs/testGetBy1.log testGetBy1_1.log || die "comparing testGetBy1.log" $?

echo "testGetBy2"
cmsRun -p ${LOCAL_TEST_DIR}/${test}2_cfg.py > testGetBy2.log 2>/dev/null || die "cmsRun ${test}2_cfg.py" $?
grep -v "Initiating request to open file" testGetBy2.log | grep -v "Successfully opened file" | grep -v "Closed file" > testGetBy2_1.log
grep -v 'Initiating request to open file\|Successfully opened file\|Closed file\|LegacyModules' testGetBy2.log > testGetBy2_1.log
diff ${LOCAL_TEST_DIR}/unit_test_outputs/testGetBy2.log testGetBy2_1.log || die "comparing testGetBy2.log" $?

echo "testGetBy3"
cmsRun -p ${LOCAL_TEST_DIR}/${test}3_cfg.py || die "cmsRun ${test}3_cfg.py" $?

echo "testConsumesInfo"
cmsRun -p ${LOCAL_TEST_DIR}/testConsumesInfo_cfg.py > testConsumesInfo.log 2>/dev/null || die "cmsRun testConsumesInfo_cfg.py" $?
grep -v "++" testConsumesInfo.log > testConsumesInfo_1.log
grep -v '++\|LegacyModules' testConsumesInfo.log > testConsumesInfo_1.log
rm testConsumesInfo.log
rm testConsumesInfo.root
diff ${LOCAL_TEST_DIR}/unit_test_outputs/testConsumesInfo_1.log testConsumesInfo_1.log || die "comparing testConsumesInfo_1.log" $?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ For products only read from previous processes, 'skip current process' is added
EndPathStatusInserter/'e'
EndPathStatusInserter/'p1ep2'

The following legacy modules are configured. Support for legacy modules
is going to end soon. These modules need to be converted to have type
edm::global, edm::stream, edm::one, or in rare cases edm::limited.
IntVectorProducer intVectorProducer
%MSG
Process name = PROD2
paths:
path1
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Integration/test/unit_test_outputs/testGetBy1.log
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e81
++++ finished: constructing module with label 'intVectorProducer' id = 14
++ preallocate: 1 concurrent runs, 1 concurrent luminosity sections, 1 streams
++ starting: begin job
The following legacy modules are configured. Support for legacy modules
is going to end soon. These modules need to be converted to have type
edm::global, edm::stream, edm::one, or in rare cases edm::limited.
IntVectorProducer intVectorProducer
%MSG
++++ starting: begin job for module with label 'intProducerA' id = 9
Module type=IntProducer, Module label=intProducerA, Parameter Set ID=38971365e8174cb2ccc12430661ba6d4
++++ finished: begin job for module with label 'intProducerA' id = 9
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Integration/test/unit_test_outputs/testGetBy2.log
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Module type=IntProducer, Module label=intProducer, Parameter Set ID=0e62dace196e
++++ finished: constructing module with label 'intVectorProducer' id = 7
++ preallocate: 1 concurrent runs, 1 concurrent luminosity sections, 1 streams
++ starting: begin job
The following legacy modules are configured. Support for legacy modules
is going to end soon. These modules need to be converted to have type
edm::global, edm::stream, edm::one, or in rare cases edm::limited.
IntVectorProducer intVectorProducer
%MSG
++++ starting: begin job for module with label 'intProducerU' id = 6
++++ finished: begin job for module with label 'intProducerU' id = 6
++++ starting: begin job for module with label 'intVectorProducer' id = 7
Expand Down
22 changes: 13 additions & 9 deletions FWCore/MessageService/test/UnitTestClient_A.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#include "FWCore/MessageService/test/UnitTestClient_A.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include <iostream>
#include <string>

namespace edmtest {

void UnitTestClient_A::analyze(edm::Event const& /*unused*/
,
edm::EventSetup const& /*unused*/
) {
class UnitTestClient_A : public edm::global::EDAnalyzer<> {
public:
explicit UnitTestClient_A(edm::ParameterSet const&) {}

void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
};

void UnitTestClient_A::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {
std::string empty_;
std::string file_ = "nameOfFile";
LogDebug("cat_A") << "LogDebug was used to send this message";
Expand All @@ -24,8 +29,7 @@ namespace edmtest {
edm::LogInfo("cat_A") << "LogInfo was used to send this message";
edm::LogInfo("cat_B") << "LogInfo was used to send this other message";
edm::LogInfo("FwkTest") << "<Message>LogInfo was used to send a job report</Message>";

} // MessageLoggerClient::analyze()
}

} // namespace edmtest

Expand Down
26 changes: 0 additions & 26 deletions FWCore/MessageService/test/UnitTestClient_A.h

This file was deleted.

22 changes: 13 additions & 9 deletions FWCore/MessageService/test/UnitTestClient_Ad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
#define EDM_ML_DEBUG
#endif

#include "FWCore/MessageService/test/UnitTestClient_Ad.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include <iostream>
#include <string>

namespace edmtest {

void UnitTestClient_Ad::analyze(edm::Event const& /*unused*/
,
edm::EventSetup const& /*unused*/
) {
class UnitTestClient_Ad : public edm::global::EDAnalyzer<> {
public:
explicit UnitTestClient_Ad(edm::ParameterSet const&) {}

void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
};

void UnitTestClient_Ad::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {
std::string empty_;
std::string file_ = "nameOfFile";
LogDebug("cat_A") << "LogDebug was used to send this message";
Expand All @@ -28,8 +33,7 @@ namespace edmtest {
edm::LogInfo("cat_A") << "LogInfo was used to send this message";
edm::LogInfo("cat_B") << "LogInfo was used to send this other message";
edm::LogInfo("FwkTest") << "<Message>LogInfo was used to send a job report</Message>";

} // MessageLoggerClient::analyze()
}

} // namespace edmtest

Expand Down
26 changes: 0 additions & 26 deletions FWCore/MessageService/test/UnitTestClient_Ad.h

This file was deleted.

28 changes: 17 additions & 11 deletions FWCore/MessageService/test/UnitTestClient_B.cc
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#include "FWCore/MessageService/test/UnitTestClient_B.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/MakerMacros.h"
// UnitTestClient_B is used for testing LogStatistics and the reset behaviors
// of statistics destinations.

#include <iostream>
#include <string>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace edmtest {

int UnitTestClient_B::nevent = 0;
class UnitTestClient_B : public edm::one::EDAnalyzer<> {
public:
explicit UnitTestClient_B(edm::ParameterSet const&) {}

void analyze(edm::Event const&, edm::EventSetup const&) override;

private:
int nevent = 0;
};

void UnitTestClient_B::analyze(edm::Event const& /*unused*/
,
edm::EventSetup const& /*unused*/
) {
void UnitTestClient_B::analyze(edm::Event const&, edm::EventSetup const&) {
nevent++;
for (int i = 0; i < nevent; ++i) {
edm::LogError("cat_A") << "LogError was used to send this message";
}
edm::LogError("cat_B") << "LogError was used to send this other message";
edm::LogStatistics();
} // MessageLoggerClient::analyze()
}

} // namespace edmtest

Expand Down
Loading