Skip to content
Merged
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
27 changes: 11 additions & 16 deletions Framework/Core/src/TopologyPolicy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,15 @@ bool expendableDataDeps(DataProcessorSpec const& a, DataProcessorSpec const& b)
bool isBExpendable = std::find_if(b.labels.begin(), b.labels.end(), checkExpendable) != b.labels.end();
bool isAExpendable = std::find_if(a.labels.begin(), a.labels.end(), checkExpendable) != a.labels.end();
bool bResilient = std::find_if(b.labels.begin(), b.labels.end(), checkResilient) != b.labels.end();
const std::regex matcher(".*output-proxy.*");
std::cmatch m;
bool isBOutputProxy = std::regex_match(b.name.data(), m, matcher);

// If none is expendable. We simply return false and sort as usual.
if (!isAExpendable && !isBExpendable) {
bool sporadic = sporadicDataDeps(a, b);
if (sporadic) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "false. Neither %s nor %s are expendable. However the former has sporadic inputs so we sort it after.",
if (sporadic && !isBOutputProxy) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "true. Neither %s nor %s are expendable. However the former has sporadic inputs so we sort it after.",
a.name.c_str(), b.name.c_str());
return true;
}
Expand All @@ -158,8 +161,8 @@ bool expendableDataDeps(DataProcessorSpec const& a, DataProcessorSpec const& b)
// If both are expendable. We return false and sort as usual.
if (isAExpendable && isBExpendable) {
bool sporadic = sporadicDataDeps(a, b);
if (sporadic) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "false. Both %s and %s are expendable. However the former has sporadic inputs, so we sort it after.",
if (sporadic && !isBOutputProxy) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "true. Both %s and %s are expendable. However the former has sporadic inputs, so we sort it after.",
a.name.c_str(), b.name.c_str());
return true;
}
Expand All @@ -171,8 +174,8 @@ bool expendableDataDeps(DataProcessorSpec const& a, DataProcessorSpec const& b)
// If a is expendable but b is resilient, we can keep the same order.
if (isAExpendable && bResilient) {
bool sporadic = sporadicDataDeps(a, b);
if (sporadic) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "false. %s is expendable but %s is resilient, however the former also has sporadic inputs, so we sort it after.",
if (sporadic && !isBOutputProxy) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "true. %s is expendable but %s is resilient, however the former also has sporadic inputs, so we sort it after.",
a.name.c_str(), b.name.c_str());
return true;
}
Expand All @@ -188,12 +191,10 @@ bool expendableDataDeps(DataProcessorSpec const& a, DataProcessorSpec const& b)
a.name.c_str(), hasDependency ? "There is however an inverse dependency" : "No inverse dependency", b.name.c_str(), a.name.c_str(),
!hasDependency ? "true" : "false");
if (!hasDependency) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "%s is expendable. There is however an inverse dependecy from %s to %s => true.",
a.name.c_str(), b.name.c_str(), a.name.c_str());
return true;
}
bool sporadic = sporadicDataDeps(a, b);
if (sporadic) {
if (sporadic && !isBOutputProxy) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "%s is expendable. No inverse dependency from %s to %s. However the former has an occasioanl input => true.",
a.name.c_str(), b.name.c_str(), a.name.c_str());
return true;
Expand All @@ -203,13 +204,6 @@ bool expendableDataDeps(DataProcessorSpec const& a, DataProcessorSpec const& b)
return false;
}
// b is expendable and a is not. We are fine with no dependency.
bool sporadic = sporadicDataDeps(a, b);
if (sporadic) {
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "false. %s is expendable but %s is not. However the former has an sporadic input => true.",
b.name.c_str(), a.name.c_str());
return true;
}
// b is expendable and a is not. We are fine with no dependency.
O2_SIGNPOST_END(topology, sid, "expendableDataDeps", "false. %s is expendable but %s is not. No need to add an unneeded dependency.",
b.name.c_str(), a.name.c_str());

Expand Down Expand Up @@ -270,6 +264,7 @@ TopologyPolicy::DependencyChecker TopologyPolicyHelpers::alwaysDependent()
hasDependency ? "true" : "false", dependent.name.c_str(), hasDependency ? "has" : "has not", ancestor.name.c_str());
return hasDependency;
}

O2_SIGNPOST_END(topology, sid, "alwaysDependent", "true by default. Ancestor %s is not an output proxy.", ancestor.name.c_str());
return true;
};
Expand Down