Skip to content

Commit a94ed77

Browse files
committed
use DEC in analysis CCDB fetcher
1 parent 38721b7 commit a94ed77

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,38 +67,38 @@ void fillValidRoutes(CCDBFetcherHelper& helper, std::vector<o2::framework::Outpu
6767
}
6868
} // namespace
6969

70-
AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& ctx)
70+
AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/)
7171
{
72-
auto& ac = ctx.services().get<DanglingEdgesContext>();
73-
std::vector<std::shared_ptr<arrow::Schema>> schemas;
74-
auto schemaMetadata = std::make_shared<arrow::KeyValueMetadata>();
72+
return adaptStateful([](ConfigParamRegistry const& options, DeviceSpec const& spec, InitContext& ic) {
73+
auto& dec = ic.services().get<DanglingEdgesContext>();
74+
std::vector<std::shared_ptr<arrow::Schema>> schemas;
75+
auto schemaMetadata = std::make_shared<arrow::KeyValueMetadata>();
7576

76-
for (auto& input : ac.analysisCCDBInputs) {
77-
std::vector<std::shared_ptr<arrow::Field>> fields;
78-
schemaMetadata->Append("outputRoute", DataSpecUtils::describe(input));
79-
schemaMetadata->Append("outputBinding", input.binding);
77+
for (auto& input : dec.analysisCCDBInputs) {
78+
std::vector<std::shared_ptr<arrow::Field>> fields;
79+
schemaMetadata->Append("outputRoute", DataSpecUtils::describe(input));
80+
schemaMetadata->Append("outputBinding", input.binding);
8081

81-
for (auto& m : input.metadata) {
82-
// Save the list of input tables
83-
if (m.name.starts_with("input:")) {
84-
auto name = m.name.substr(6);
85-
schemaMetadata->Append("sourceTable", name);
86-
schemaMetadata->Append("sourceMatcher", DataSpecUtils::describe(std::get<ConcreteDataMatcher>(DataSpecUtils::fromMetadataString(m.defaultValue.get<std::string>()).matcher)));
87-
continue;
88-
}
89-
// Ignore the non ccdb: entries
90-
if (!m.name.starts_with("ccdb:")) {
91-
continue;
82+
for (auto& m : input.metadata) {
83+
// Save the list of input tables
84+
if (m.name.starts_with("input:")) {
85+
auto name = m.name.substr(6);
86+
schemaMetadata->Append("sourceTable", name);
87+
continue;
88+
}
89+
// Ignore the non ccdb: entries
90+
if (!m.name.starts_with("ccdb:")) {
91+
continue;
92+
}
93+
// Create the schema of the output
94+
auto metadata = std::make_shared<arrow::KeyValueMetadata>();
95+
metadata->Append("url", m.defaultValue.asString());
96+
auto columnName = m.name.substr(strlen("ccdb:"));
97+
fields.emplace_back(std::make_shared<arrow::Field>(columnName, arrow::binary_view(), false, metadata));
9298
}
93-
// Create the schema of the output
94-
auto metadata = std::make_shared<arrow::KeyValueMetadata>();
95-
metadata->Append("url", m.defaultValue.asString());
96-
auto columnName = m.name.substr(strlen("ccdb:"));
97-
fields.emplace_back(std::make_shared<arrow::Field>(columnName, arrow::binary_view(), false, metadata));
99+
schemas.emplace_back(std::make_shared<arrow::Schema>(fields, schemaMetadata));
98100
}
99-
schemas.emplace_back(std::make_shared<arrow::Schema>(fields, schemaMetadata));
100-
}
101-
return adaptStateful([schemas](CallbackService& callbacks, ConfigParamRegistry const& options, DeviceSpec const& spec) {
101+
102102
std::shared_ptr<CCDBFetcherHelper> helper = std::make_shared<CCDBFetcherHelper>();
103103
CCDBFetcherHelper::initialiseHelper(*helper, options);
104104
std::unordered_map<std::string, int> bindings;

Framework/CCDBSupport/src/AnalysisCCDBHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace o2::framework
1717
{
1818

1919
struct AnalysisCCDBHelpers {
20-
static AlgorithmSpec fetchFromCCDB(ConfigContext const& ctx);
20+
static AlgorithmSpec fetchFromCCDB(ConfigContext const&);
2121
};
2222

2323
} // namespace o2::framework

0 commit comments

Comments
 (0)