Skip to content

Commit

Permalink
Merge pull request #37305 from Dr15Jones/ConditionalTask
Browse files Browse the repository at this point in the history
Added ConditionalTask
  • Loading branch information
cmsbuild authored Apr 7, 2022
2 parents e7347a0 + 8b99210 commit 456b182
Show file tree
Hide file tree
Showing 24 changed files with 1,503 additions and 118 deletions.
4 changes: 4 additions & 0 deletions DataFormats/Provenance/interface/ProductResolverIndexHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ namespace edm {
// If the TypeID for the wrapped type is already available,
// it is faster to call getContainedTypeFromWrapper directly.
TypeID getContainedType(TypeID const& typeID);

bool typeIsViewCompatible(TypeID const& requestedViewType,
TypeID const& wrappedtypeID,
std::string const& className);
} // namespace productholderindexhelper

class ProductResolverIndexHelper {
Expand Down
26 changes: 26 additions & 0 deletions DataFormats/Provenance/src/ProductResolverIndexHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ namespace edm {
TypeID const wrappedTypeID = TypeID(wrappedType.typeInfo());
return getContainedTypeFromWrapper(wrappedTypeID, className);
}

bool typeIsViewCompatible(TypeID const& requestedViewType,
TypeID const& wrappedtypeID,
std::string const& className) {
auto elementType = getContainedTypeFromWrapper(wrappedtypeID, className);
if (elementType == TypeID(typeid(void)) or elementType == TypeID()) {
//the wrapped type is not a container
return false;
}
if (elementType == requestedViewType) {
return true;
}
//need to check for inheritance match
std::vector<std::string> missingDictionaries;
std::vector<TypeWithDict> baseTypes;
if (!public_base_classes(missingDictionaries, elementType, baseTypes)) {
return false;
}
for (auto const& base : baseTypes) {
if (TypeID(base.typeInfo()) == requestedViewType) {
return true;
}
}
return false;
}

} // namespace productholderindexhelper

ProductResolverIndexHelper::ProductResolverIndexHelper()
Expand Down
1 change: 1 addition & 0 deletions FWCore/Framework/interface/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace edm {
int timesFailed(size_type i) const { return workers_.at(i).timesFailed(); }
int timesExcept(size_type i) const { return workers_.at(i).timesExcept(); }
Worker const* getWorker(size_type i) const { return workers_.at(i).getWorker(); }
unsigned int bitPosition(size_type i) const { return workers_.at(i).bitPosition(); }

void setEarlyDeleteHelpers(std::map<const Worker*, EarlyDeleteHelper*> const&);

Expand Down
16 changes: 16 additions & 0 deletions FWCore/Framework/interface/StreamSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#include <vector>
#include <sstream>
#include <atomic>
#include <unordered_set>

namespace edm {

Expand Down Expand Up @@ -288,6 +289,21 @@ namespace edm {

void reportSkipped(EventPrincipal const& ep) const;

struct AliasInfo {
std::string friendlyClassName;
std::string instanceLabel;
std::string originalInstanceLabel;
std::string originalModuleLabel;
};
std::vector<Worker*> tryToPlaceConditionalModules(
Worker*,
std::unordered_set<std::string>& conditionalModules,
std::multimap<std::string, edm::BranchDescription const*> const& conditionalModuleBranches,
std::multimap<std::string, AliasInfo> const& aliasMap,
ParameterSet& proc_pset,
ProductRegistry& preg,
PreallocationConfiguration const* prealloc,
std::shared_ptr<ProcessConfiguration const> processConfiguration);
void fillWorkers(ParameterSet& proc_pset,
ProductRegistry& preg,
PreallocationConfiguration const* prealloc,
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/TriggerNamesService.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <string>
#include <map>
#include <vector>
#include <unordered_set>

namespace edm {

Expand Down Expand Up @@ -83,7 +84,6 @@ namespace edm {
std::string const& getTrigPathModule(size_type const i, size_type const j) const {
return (modulenames_.at(i)).at(j);
}

Strings const& getEndPathModules(std::string const& name) const {
return end_modulenames_.at(find(end_pos_, name));
}
Expand Down
1 change: 1 addition & 0 deletions FWCore/Framework/interface/WorkerInPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace edm {
FilterAction filterAction() const { return filterAction_; }
Worker* getWorker() const { return worker_; }
bool runConcurrently() const noexcept { return runConcurrently_; }
unsigned int bitPosition() const noexcept { return placeInPathContext_.placeInPath(); }

void setPathContext(PathContext const* v) { placeInPathContext_.setPathContext(v); }

Expand Down
5 changes: 3 additions & 2 deletions FWCore/Framework/src/Path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,11 @@ namespace edm {
EventTransitionInfo const& iInfo,
StreamID const& streamID) {
updateCounters(state_);
recordStatus(failedModuleIndex_, state_);
auto failedModuleBitPosition = bitPosition(failedModuleIndex_);
recordStatus(failedModuleBitPosition, state_);
// Caught exception is propagated via WaitingTaskList
CMS_SA_ALLOW try {
HLTPathStatus status(state_, failedModuleIndex_);
HLTPathStatus status(state_, failedModuleBitPosition);

if (pathStatusInserter_) { // pathStatusInserter is null for EndPaths
pathStatusInserter_->setPathStatus(streamID, status);
Expand Down
6 changes: 2 additions & 4 deletions FWCore/Framework/src/Schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1042,14 +1042,12 @@ namespace edm {
<< "Name"
<< "";

unsigned int bitpos = 0;
for (auto const& mod : p.moduleInPathSummaries) {
LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
<< bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
<< std::right << std::setw(10) << mod.timesPassed << " " << std::right
<< mod.bitPosition << " " << std::right << std::setw(10) << mod.timesVisited
<< " " << std::right << std::setw(10) << mod.timesPassed << " " << std::right
<< std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
<< mod.timesExcept << " " << mod.moduleLabel << "";
++bitpos;
}
}

Expand Down
Loading

0 comments on commit 456b182

Please sign in to comment.