Skip to content

Commit adf24a1

Browse files
committed
use ranges to populate requestedDYNs and spawnerInputs in adjustTopology
1 parent c875b91 commit adf24a1

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

Framework/Core/src/ArrowSupport.cxx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -617,37 +617,27 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
617617

618618
if (spawner != workflow.end()) {
619619
// collect currently requested DYNs
620-
for (auto& d : workflow) {
621-
if (d.name == spawner->name) {
622-
continue;
623-
}
624-
for (auto const& i : d.inputs) {
625-
if (DataSpecUtils::partialMatch(i, header::DataOrigin{"DYN"})) {
626-
auto copy = i;
627-
DataSpecUtils::updateInputList(ac.requestedDYNs, std::move(copy));
628-
}
629-
}
630-
for (auto const& o : d.outputs) {
631-
if (DataSpecUtils::partialMatch(o, header::DataOrigin{"DYN"})) {
632-
ac.providedDYNs.emplace_back(o);
633-
}
634-
}
620+
for (auto& d : workflow | views::exclude_by_name(spawner->name)) {
621+
d.inputs |
622+
views::partial_match_filter(header::DataOrigin{"DYN"}) |
623+
sinks::update_input_list{ac.requestedDYNs};
624+
d.outputs |
625+
views::partial_match_filter(header::DataOrigin{"DYN"}) |
626+
sinks::append_to{ac.providedDYNs};
635627
}
636628
std::sort(ac.requestedDYNs.begin(), ac.requestedDYNs.end(), inputSpecLessThan);
637629
std::sort(ac.providedDYNs.begin(), ac.providedDYNs.end(), outputSpecLessThan);
638630
ac.spawnerInputs.clear();
639-
for (auto& input : ac.requestedDYNs) {
640-
if (std::none_of(ac.providedDYNs.begin(), ac.providedDYNs.end(), [&input](auto const& x) { return DataSpecUtils::match(input, x); })) {
641-
ac.spawnerInputs.emplace_back(input);
642-
}
643-
}
631+
ac.requestedDYNs |
632+
views::filter_not_matching(ac.providedDYNs) |
633+
sinks::append_to{ac.spawnerInputs};
644634
// recreate inputs and outputs
645635
spawner->outputs.clear();
646636
spawner->inputs.clear();
637+
AnalysisSupportHelpers::addMissingOutputsToSpawner({}, ac.spawnerInputs, ac.requestedAODs, *spawner);
647638
// replace AlgorithmSpec
648639
// FIXME: it should be made more generic, so it does not need replacement...
649640
spawner->algorithm = PluginManager::loadAlgorithmFromPlugin("O2FrameworkOnDemandTablesSupport", "ExtendedTableSpawner", ctx);
650-
AnalysisSupportHelpers::addMissingOutputsToSpawner({}, ac.spawnerInputs, ac.requestedAODs, *spawner);
651641
}
652642

653643
if (analysisCCDB != workflow.end()) {

0 commit comments

Comments
 (0)