Skip to content

Commit a31a141

Browse files
committed
explicitly subscribe dummy sink to TFN&TFF
1 parent ddb34af commit a31a141

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

Framework/Core/src/ArrowSupport.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
687687
});
688688
if (tfnsource == workflow.end()) { // add normal reader algorithm only if no on-the-fly generator is injected
689689
reader->algorithm = CommonDataProcessors::wrapWithTimesliceConsumption(PluginManager::loadAlgorithmFromPlugin("O2FrameworkAnalysisSupport", "ROOTFileReader", ctx));
690-
} // otherwise the algorithm was set in injectServiceDevices
690+
} // otherwise the algorithm was already set in injectServiceDevices
691691
}
692692
}
693693

Framework/Core/src/WorkflowHelpers.cxx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,13 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
409409
extraSpecs.push_back(indexBuilder);
410410
}
411411

412+
auto tfnsource = std::ranges::find_if(workflow, [](DataProcessorSpec const& spec) {
413+
return std::ranges::any_of(spec.outputs, [](OutputSpec const& output) {
414+
return DataSpecUtils::match(output, "TFN", "TFNumber", 0);
415+
});
416+
});
412417
// add the reader
413418
if (aodReader.outputs.empty() == false) {
414-
auto tfnsource = std::ranges::find_if(workflow, [](DataProcessorSpec const& spec) {
415-
return std::ranges::any_of(spec.outputs, [](OutputSpec const& output) {
416-
return DataSpecUtils::match(output, "TFN", "TFNumber", 0);
417-
});
418-
});
419419
if (tfnsource == workflow.end()) {
420420
// add normal reader
421421
aodReader.outputs.emplace_back(OutputSpec{"TFN", "TFNumber"});
@@ -557,6 +557,12 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
557557

558558
std::vector<InputSpec> unmatched;
559559
auto forwardingDestination = ctx.options().get<std::string>("forwarding-destination");
560+
// update tfnsource iterator (could be aod-reader)
561+
tfnsource = std::ranges::find_if(workflow, [](DataProcessorSpec const& spec) {
562+
return std::ranges::any_of(spec.outputs, [](OutputSpec const& output) {
563+
return DataSpecUtils::match(output, "TFN", "TFNumber", 0);
564+
});
565+
});
560566
if (redirectedOutputsInputs.size() > 0 && forwardingDestination == "file") {
561567
auto fileSink = CommonDataProcessors::getGlobalFileSink(redirectedOutputsInputs, unmatched);
562568
if (unmatched.size() != redirectedOutputsInputs.size()) {
@@ -568,7 +574,7 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
568574
} else if (forwardingDestination != "drop") {
569575
throw runtime_error_f("Unknown forwarding destination %s", forwardingDestination.c_str());
570576
}
571-
if (unmatched.size() > 0 || redirectedOutputsInputs.size() > 0) {
577+
if ((unmatched.size() > 0) || (redirectedOutputsInputs.size() > 0) || (tfnsource != workflow.end())) {
572578
std::vector<InputSpec> ignored = unmatched;
573579
ignored.insert(ignored.end(), redirectedOutputsInputs.begin(), redirectedOutputsInputs.end());
574580
for (auto& ignoredInput : ignored) {
@@ -577,8 +583,11 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
577583

578584
// Use the new dummy sink when the AOD reader is there
579585
O2_SIGNPOST_ID_GENERATE(sid, workflow_helpers);
580-
if (aodReader.outputs.empty() == false) {
586+
if (tfnsource != workflow.end()) {
581587
O2_SIGNPOST_EVENT_EMIT(workflow_helpers, sid, "injectServiceDevices", "Injecting scheduled dummy sink");
588+
// if there is a tfnsource, make sure the sink has
589+
ignored.emplace_back("tfn", "TFN", "TFNumber");
590+
ignored.emplace_back("tff", "TFF", "TFFilename");
582591
extraSpecs.push_back(CommonDataProcessors::getScheduledDummySink(ignored));
583592
} else {
584593
O2_SIGNPOST_EVENT_EMIT(workflow_helpers, sid, "injectServiceDevices", "Injecting rate limited dummy sink");

0 commit comments

Comments
 (0)