@@ -67,37 +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- continue ;
87- }
88- // Ignore the non ccdb: entries
89- if (!m.name .starts_with (" ccdb:" )) {
90- 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));
9198 }
92- // Create the schema of the output
93- auto metadata = std::make_shared<arrow::KeyValueMetadata>();
94- metadata->Append (" url" , m.defaultValue .asString ());
95- auto columnName = m.name .substr (strlen (" ccdb:" ));
96- 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));
97100 }
98- schemas.emplace_back (std::make_shared<arrow::Schema>(fields, schemaMetadata));
99- }
100- return adaptStateful ([schemas](CallbackService& callbacks, ConfigParamRegistry const & options, DeviceSpec const & spec) {
101+
101102 std::shared_ptr<CCDBFetcherHelper> helper = std::make_shared<CCDBFetcherHelper>();
102103 CCDBFetcherHelper::initialiseHelper (*helper, options);
103104 std::unordered_map<std::string, int > bindings;
0 commit comments