Skip to content

Commit 8eb7d96

Browse files
authored
Merge 53c801a into sapling-pr-archive-ktf
2 parents 022a755 + 53c801a commit 8eb7d96

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

Framework/AnalysisSupport/src/AODJAlienReaderHelpers.cxx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,23 @@ static inline auto extractOriginalsTuple(framework::pack<Os...>, ProcessingConte
118118
return std::make_tuple(extractTypedOriginal<Os>(pc)...);
119119
}
120120

121-
AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const& config)
121+
AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const& ctx)
122122
{
123123
// aod-parent-base-path-replacement is now a workflow option, so it needs to be
124124
// retrieved from the ConfigContext. This is because we do not allow workflow options
125125
// to change over start-stop-start because they can affect the topology generation.
126126
std::string parentFileReplacement;
127-
if (config.options().isSet("aod-parent-base-path-replacement")) {
128-
parentFileReplacement = config.options().get<std::string>("aod-parent-base-path-replacement");
127+
if (ctx.options().isSet("aod-parent-base-path-replacement")) {
128+
parentFileReplacement = ctx.options().get<std::string>("aod-parent-base-path-replacement");
129129
}
130-
auto callback = AlgorithmSpec{adaptStateful([parentFileReplacement](ConfigParamRegistry const& options,
131-
DeviceSpec const& spec,
132-
Monitoring& monitoring,
133-
DataProcessingStats& stats) {
130+
int parentAccessLevel = 0;
131+
if (ctx.options().isSet("aod-parent-access-level")) {
132+
parentAccessLevel = ctx.options().get<int>("aod-parent-access-level");
133+
}
134+
auto callback = AlgorithmSpec{adaptStateful([parentFileReplacement, parentAccessLevel](ConfigParamRegistry const& options,
135+
DeviceSpec const& spec,
136+
Monitoring& monitoring,
137+
DataProcessingStats& stats) {
134138
// FIXME: not actually needed, since data processing stats can specify that we should
135139
// send the initial value.
136140
stats.updateStats({static_cast<short>(ProcessingStatsId::ARROW_BYTES_CREATED), DataProcessingStats::Op::Set, 0});
@@ -148,11 +152,6 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const
148152

149153
auto maxRate = options.get<float>("aod-max-io-rate");
150154

151-
int parentAccessLevel = 0;
152-
if (options.isSet("aod-parent-access-level")) {
153-
parentAccessLevel = options.get<int>("aod-parent-access-level");
154-
}
155-
156155
// create a DataInputDirector
157156
auto didir = std::make_shared<DataInputDirector>(filename, &monitoring, parentAccessLevel, parentFileReplacement);
158157
if (options.isSet("aod-reader-json")) {

Framework/AnalysisSupport/src/Plugin.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,20 @@ struct DiscoverMetadataInAOD : o2::framework::ConfigDiscoveryPlugin {
150150
return results;
151151
}
152152

153-
// Lets try in parent files
153+
if (!registry.isSet("aod-parent-access-level") || registry.get<int>("aod-parent-access-level") == 0) {
154+
LOGP(info, "No metadata found in file \"{}\" and parent level 0 prevents further lookup.", filename);
155+
results.push_back(ConfigParamSpec{"aod-metadata-disable", VariantType::String, "1", {"Metadata not found in AOD"}});
156+
return results;
157+
}
158+
159+
// Lets try in parent file.
154160
auto parentFiles = (TMap*)currentFile->Get("parentFiles");
155161
if (!parentFiles) {
156162
LOGP(info, "No metadata found in file \"{}\"", filename);
157163
results.push_back(ConfigParamSpec{"aod-metadata-disable", VariantType::String, "1", {"Metadata not found in AOD"}});
158164
return results;
159165
}
166+
LOGP(info, "No metadata found in file \"{}\", checking in its parents.", filename);
160167
for (auto* p : *parentFiles) {
161168
std::string parentFilename = ((TPair*)p)->Value()->GetName();
162169
// Do the replacement. Notice this will require changing aod-parent-base-path-replacement to be

Framework/Core/src/Plugin.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct DiscoverAODOptionsInCommandLine : o2::framework::ConfigDiscoveryPlugin {
141141
bool injectOption = true;
142142
for (size_t i = 0; i < argc; i++) {
143143
std::string_view arg = argv[i];
144-
if (!arg.starts_with("--aod-writer-") && arg != "--aod-parent-base-path-replacement") {
144+
if (!arg.starts_with("--aod-writer-") && !arg.starts_with("--aod-parent-")) {
145145
continue;
146146
}
147147
std::string key = arg.data() + 2;
@@ -156,6 +156,9 @@ struct DiscoverAODOptionsInCommandLine : o2::framework::ConfigDiscoveryPlugin {
156156
if (key == "aod-parent-base-path-replacement") {
157157
results.push_back(ConfigParamSpec{"aod-parent-base-path-replacement", VariantType::String, value, {R"(Replace base path of parent files. Syntax: FROM;TO. E.g. "alien:///path/in/alien;/local/path". Enclose in "" on the command line.)"}});
158158
}
159+
if (key == "aod-parent-access-level") {
160+
results.push_back(ConfigParamSpec{"aod-parent-access-level", VariantType::String, value, {"Allow parent file access up to specified level. Default: no (0)"}});
161+
}
159162
}
160163
if (injectOption) {
161164
results.push_back(ConfigParamSpec{"aod-writer-compression", VariantType::Int, 505, {"AOD Compression options"}});

Framework/Core/src/WorkflowHelpers.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
216216
.options = {ConfigParamSpec{"aod-file-private", VariantType::String, ctx.options().get<std::string>("aod-file"), {"AOD file"}},
217217
ConfigParamSpec{"aod-max-io-rate", VariantType::Float, 0.f, {"Maximum I/O rate in MB/s"}},
218218
ConfigParamSpec{"aod-reader-json", VariantType::String, {"json configuration file"}},
219-
ConfigParamSpec{"aod-parent-access-level", VariantType::String, {"Allow parent file access up to specified level. Default: no (0)"}},
220219
ConfigParamSpec{"time-limit", VariantType::Int64, 0ll, {"Maximum run time limit in seconds"}},
221220
ConfigParamSpec{"orbit-offset-enumeration", VariantType::Int64, 0ll, {"initial value for the orbit"}},
222221
ConfigParamSpec{"orbit-multiplier-enumeration", VariantType::Int64, 0ll, {"multiplier to get the orbit from the counter"}},

0 commit comments

Comments
 (0)