Skip to content

Commit

Permalink
Merge pull request #36458 from makortel/backportStatisticsSenderServi…
Browse files Browse the repository at this point in the history
…ce_94x

[9_4_X] Protect storage accounting UDP messages from NaN, and Use StatisticsSenderService for all framework files
  • Loading branch information
cmsbuild authored Dec 14, 2021
2 parents 751e817 + d5bf116 commit cc00bf4
Show file tree
Hide file tree
Showing 23 changed files with 1,882 additions and 1,704 deletions.
92 changes: 44 additions & 48 deletions IOPool/Input/src/EmbeddedRootSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,85 +13,81 @@ namespace edm {
class EventID;
class EventPrincipal;

EmbeddedRootSource::EmbeddedRootSource(ParameterSet const& pset, VectorInputSourceDescription const& desc) :
VectorInputSource(pset, desc),
rootServiceChecker_(),
nStreams_(desc.allocations_->numberOfStreams()),
// The default value provided as the second argument to the getUntrackedParameter function call
// is not used when the ParameterSet has been validated and the parameters are not optional
// in the description. This is currently true when PoolSource is the primary input source.
// The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
// yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
// have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
// and should be deleted from the code.
//
skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
productSelectorRules_(pset, "inputCommands", "InputSource"),
runHelper_(new DefaultRunHelper()),
catalog_(pset.getUntrackedParameter<std::vector<std::string> >("fileNames"),
pset.getUntrackedParameter<std::string>("overrideCatalog", std::string())),
// Note: fileSequence_ needs to be initialized last, because it uses data members
// initialized previously in its own initialization.
fileSequence_(new RootEmbeddedFileSequence(pset, *this, catalog_)) {
}
EmbeddedRootSource::EmbeddedRootSource(ParameterSet const& pset, VectorInputSourceDescription const& desc)
: VectorInputSource(pset, desc),
rootServiceChecker_(),
nStreams_(desc.allocations_->numberOfStreams()),
// The default value provided as the second argument to the getUntrackedParameter function call
// is not used when the ParameterSet has been validated and the parameters are not optional
// in the description. This is currently true when PoolSource is the primary input source.
// The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
// yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
// have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
// and should be deleted from the code.
//
skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
productSelectorRules_(pset, "inputCommands", "InputSource"),
runHelper_(new DefaultRunHelper()),
catalog_(pset.getUntrackedParameter<std::vector<std::string> >("fileNames"),
pset.getUntrackedParameter<std::string>("overrideCatalog", std::string())),
// Note: fileSequence_ needs to be initialized last, because it uses data members
// initialized previously in its own initialization.
fileSequence_(new RootEmbeddedFileSequence(pset, *this, catalog_)) {}

EmbeddedRootSource::~EmbeddedRootSource() {}

void
EmbeddedRootSource::beginJob() {
}
void EmbeddedRootSource::beginJob() {}

void
EmbeddedRootSource::endJob() {
void EmbeddedRootSource::endJob() {
fileSequence_->endJob();
InputFile::reportReadBranches();
}

void EmbeddedRootSource::closeFile_() {
fileSequence_->closeFile_();
}
void EmbeddedRootSource::closeFile_() { fileSequence_->closeFile(); }

bool
EmbeddedRootSource::readOneEvent(EventPrincipal& cache, size_t& fileNameHash, CLHEP::HepRandomEngine* engine, EventID const* id, bool recycleFiles) {
bool EmbeddedRootSource::readOneEvent(EventPrincipal& cache,
size_t& fileNameHash,
CLHEP::HepRandomEngine* engine,
EventID const* id,
bool recycleFiles) {
return fileSequence_->readOneEvent(cache, fileNameHash, engine, id, recycleFiles);
}

void
EmbeddedRootSource::readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, SecondaryEventIDAndFileInfo const& id) {
void EmbeddedRootSource::readOneSpecified(EventPrincipal& cache,
size_t& fileNameHash,
SecondaryEventIDAndFileInfo const& id) {
fileSequence_->readOneSpecified(cache, fileNameHash, id);
}

void
EmbeddedRootSource::dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) {
void EmbeddedRootSource::dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) {
std::vector<std::string> rules;
rules.reserve(wantedBranches.size() + 1);
rules.emplace_back("drop *");
for(std::string const& branch : wantedBranches) {
for (std::string const& branch : wantedBranches) {
rules.push_back("keep " + branch + "_*");
}
ParameterSet pset;
pset.addUntrackedParameter("inputCommands", rules);
productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
}

void
EmbeddedRootSource::fillDescriptions(ConfigurationDescriptions& descriptions) {

void EmbeddedRootSource::fillDescriptions(ConfigurationDescriptions& descriptions) {
ParameterSetDescription desc;

std::vector<std::string> defaultStrings;
desc.setComment("Reads EDM/Root files for mixing.");
desc.addUntracked<std::vector<std::string> >("fileNames")
->setComment("Names of files to be processed.");
desc.addUntracked<std::vector<std::string> >("fileNames")->setComment("Names of files to be processed.");
desc.addUntracked<std::string>("overrideCatalog", std::string());
desc.addUntracked<bool>("skipBadFiles", false)
->setComment("True: Ignore any missing or unopenable input file.\n"
"False: Throw exception if missing or unopenable input file.");
->setComment(
"True: Ignore any missing or unopenable input file.\n"
"False: Throw exception if missing or unopenable input file.");
desc.addUntracked<bool>("bypassVersionCheck", false)
->setComment("True: Bypass release version check.\n"
"False: Throw exception if reading file in a release prior to the release in which the file was written.");
->setComment(
"True: Bypass release version check.\n"
"False: Throw exception if reading file in a release prior to the release in which the file was written.");
desc.addUntracked<int>("treeMaxVirtualSize", -1)
->setComment("Size of ROOT TTree TBasket cache. Affects performance.");

Expand All @@ -100,4 +96,4 @@ namespace edm {

descriptions.add("source", desc);
}
}
} // namespace edm
Loading

0 comments on commit cc00bf4

Please sign in to comment.