Skip to content

Commit 43ea930

Browse files
authored
Merge pull request #135 from alibuild/alibot-cleanup-15402
2 parents af903ee + ba73ee1 commit 43ea930

8 files changed

Lines changed: 37 additions & 38 deletions

File tree

Framework/AnalysisSupport/src/AODJAlienReaderHelpers.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const
240240
// create header
241241
auto concrete = DataSpecUtils::asConcreteDataMatcher(route.matcher);
242242
auto dh = header::DataHeader(concrete.description, concrete.origin, concrete.subSpec);
243-
bool wasAOD = std::ranges::any_of(route.matcher.metadata, [](ConfigParamSpec const& p){ return p.name.starts_with("aod-origin-replaced"); });
243+
bool wasAOD = std::ranges::any_of(route.matcher.metadata, [](ConfigParamSpec const& p) { return p.name.starts_with("aod-origin-replaced"); });
244244

245245
if (!didir->readTree(outputs, dh, fcnt, ntf, totalSizeCompressed, totalSizeUncompressed, wasAOD)) {
246246
if (first) {

Framework/Core/include/Framework/ASoA.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,12 +1744,13 @@ auto doFilteredSliceBy(T const* table, o2::framework::PresliceBase<C, framework:
17441744
template <soa::is_table T>
17451745
auto doSliceByCached(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
17461746
{
1747-
auto localCache = cache.ptr->getCacheFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m){
1747+
auto localCache = cache.ptr->getCacheFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
17481748
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
17491749
m.origin = o;
17501750
}
17511751
return m;
1752-
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)), node.name});
1752+
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1753+
node.name});
17531754
auto [offset, count] = localCache.getSliceFor(value);
17541755
auto t = typename T::self_t({table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count)}, static_cast<uint64_t>(offset));
17551756
if (t.tableSize() != 0) {
@@ -1761,12 +1762,13 @@ auto doSliceByCached(T const* table, framework::expressions::BindingNode const&
17611762
template <soa::is_filtered_table T>
17621763
auto doFilteredSliceByCached(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
17631764
{
1764-
auto localCache = cache.ptr->getCacheFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m){
1765+
auto localCache = cache.ptr->getCacheFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
17651766
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
17661767
m.origin = o;
17671768
}
17681769
return m;
1769-
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)), node.name});
1770+
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1771+
node.name});
17701772
auto [offset, count] = localCache.getSliceFor(value);
17711773
auto slice = table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count);
17721774
return prepareFilteredSlice(table, slice, offset);
@@ -1775,12 +1777,13 @@ auto doFilteredSliceByCached(T const* table, framework::expressions::BindingNode
17751777
template <soa::is_table T>
17761778
auto doSliceByCachedUnsorted(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
17771779
{
1778-
auto localCache = cache.ptr->getCacheUnsortedFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m){
1780+
auto localCache = cache.ptr->getCacheUnsortedFor({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
17791781
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
17801782
m.origin = o;
17811783
}
17821784
return m;
1783-
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)), node.name});
1785+
}(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1786+
node.name});
17841787
if constexpr (soa::is_filtered_table<T>) {
17851788
auto t = typename T::self_t({table->asArrowTable()}, localCache.getSliceFor(value));
17861789
if (t.tableSize() != 0) {

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ constexpr auto tableRef2InputSpec(header::DataOrigin newOrigin = header::DataOri
415415
sources = getInputMetadata<typename o2::aod::MetadataTrait<o2::aod::Hash<R.desc_hash>>::metadata, o2::aod::Hash<R.origin_hash>>();
416416
}
417417
if ((R.origin_hash == "AOD"_h) && (newOrigin != header::DataOrigin{"AOD"})) {
418-
std::ranges::transform(sources, sources.begin(), [originStr = newOrigin.as<std::string>()](framework::ConfigParamSpec& source){
418+
std::ranges::transform(sources, sources.begin(), [originStr = newOrigin.as<std::string>()](framework::ConfigParamSpec& source) {
419419
return replaceOrigin(source, originStr);
420420
});
421421
metadata.push_back(framework::ConfigParamSpec{"aod-origin-replaced", framework::VariantType::Bool, true, {"\"\""}});
@@ -432,12 +432,12 @@ constexpr auto tableRef2InputSpec(header::DataOrigin newOrigin = header::DataOri
432432
}
433433

434434
return framework::InputSpec{
435-
o2::aod::label<R>(),
436-
((R.origin_hash == "AOD"_h) && (newOrigin != header::DataOrigin{"AOD"})) ? newOrigin : o2::aod::origin<R>(),
437-
o2::aod::description(o2::aod::signature<R>()),
438-
R.version,
439-
framework::Lifetime::Timeframe,
440-
metadata};
435+
o2::aod::label<R>(),
436+
((R.origin_hash == "AOD"_h) && (newOrigin != header::DataOrigin{"AOD"})) ? newOrigin : o2::aod::origin<R>(),
437+
o2::aod::description(o2::aod::signature<R>()),
438+
R.version,
439+
framework::Lifetime::Timeframe,
440+
metadata};
441441
}
442442

443443
template <TableRef R>
@@ -632,11 +632,10 @@ struct TableTransform {
632632
std::vector<InputSpec> requiredInputs = getRequiredInputs();
633633
static std::vector<InputSpec> getRequiredInputs(header::DataOrigin const& newOrigin = header::DataOrigin{"AOD"})
634634
{
635-
return [&newOrigin]<size_t... Is>(std::index_sequence<Is...>){
636-
return std::vector{soa::tableRef2InputSpec<sources[Is]>(newOrigin)...};
637-
}(std::make_index_sequence<sources.size()>());
635+
return [&newOrigin]<size_t... Is>(std::index_sequence<Is...>) {
636+
return std::vector{soa::tableRef2InputSpec<sources[Is]>(newOrigin)...};
637+
}(std::make_index_sequence<sources.size()>());
638638
}
639-
640639
};
641640

642641
/// This helper struct allows you to declare extended tables which should be
@@ -654,7 +653,6 @@ constexpr auto transformBase()
654653
return TableTransform<metadata, metadata::template extension_table_t_from<o2::aod::Hash<T::originals[T::originals.size() - 1].origin_hash>>::ref>{};
655654
}
656655

657-
658656
/// In a multi-origin case the origin is provided by the type
659657
/// FIXME: In a rewritten origin case the output designation needs to be changed (through base class)
660658
/// The extraction of the elements needs to be changed in AnalysisManagers using the origin information from the base class
@@ -834,7 +832,6 @@ concept is_builds = requires(T t) {
834832
requires std::same_as<decltype(t.map), std::vector<soa::IndexRecord>>;
835833
};
836834

837-
838835
/// a task with rewritten origin, if running together with a task with the default, will
839836
/// have a different name and thus its output would be routed separately
840837

Framework/Core/include/Framework/AnalysisManagers.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bool updateOutputSpec(T& entity, header::DataOrigin newOrigin = header::DataOrig
193193
template <is_produces_group T>
194194
bool updateOutputSpec(T& producesGroup, header::DataOrigin newOrigin = header::DataOrigin{"AOD"})
195195
{
196-
homogeneous_apply_refs<true>([&newOrigin](auto& produces){ return updateOutputSpec(produces, newOrigin); }, producesGroup);
196+
homogeneous_apply_refs<true>([&newOrigin](auto& produces) { return updateOutputSpec(produces, newOrigin); }, producesGroup);
197197
}
198198

199199
template <typename C>
@@ -312,7 +312,7 @@ template <is_spawns T>
312312
bool prepareOutput(ProcessingContext& context, T& spawns)
313313
{
314314
using metadata = o2::aod::MetadataTrait<o2::aod::Hash<T::spawnable_t::originals[T::spawnable_t::originals.size() - 1].desc_hash>>::metadata;
315-
auto originalTable = soa::ArrowHelpers::joinTables( framework::extractTablesFromRecord(context.inputs(), spawns.requiredInputs | std::views::transform([](auto const& input){ return DataSpecUtils::asConcreteDataMatcher(input); }) ) );
315+
auto originalTable = soa::ArrowHelpers::joinTables(framework::extractTablesFromRecord(context.inputs(), spawns.requiredInputs | std::views::transform([](auto const& input) { return DataSpecUtils::asConcreteDataMatcher(input); })));
316316
if (originalTable->num_rows() == 0) {
317317
originalTable = makeEmptyTable("EMPTY", typename metadata::base_table_t::persistent_columns_t{});
318318
}
@@ -330,15 +330,15 @@ bool prepareOutput(ProcessingContext& context, T& spawns)
330330
template <is_builds T>
331331
bool prepareOutput(ProcessingContext& context, T& builds)
332332
{
333-
return builds.build(framework::extractTablesFromRecord(context.inputs(), builds.requiredInputs | std::views::transform([](auto const& input){ return DataSpecUtils::asConcreteDataMatcher(input); }) ));
333+
return builds.build(framework::extractTablesFromRecord(context.inputs(), builds.requiredInputs | std::views::transform([](auto const& input) { return DataSpecUtils::asConcreteDataMatcher(input); })));
334334
}
335335

336336
template <is_defines T>
337337
bool prepareOutput(ProcessingContext& context, T& defines)
338338
requires(T::delayed == false)
339339
{
340340
using metadata = o2::aod::MetadataTrait<o2::aod::Hash<T::spawnable_t::originals[T::spawnable_t::originals.size() - 1].desc_hash>>::metadata;
341-
auto originalTable = soa::ArrowHelpers::joinTables( framework::extractTablesFromRecord(context.inputs(), defines.requiredInputs | std::views::transform([](auto const& input){ return DataSpecUtils::asConcreteDataMatcher(input); }) ) );
341+
auto originalTable = soa::ArrowHelpers::joinTables(framework::extractTablesFromRecord(context.inputs(), defines.requiredInputs | std::views::transform([](auto const& input) { return DataSpecUtils::asConcreteDataMatcher(input); })));
342342
if (originalTable->num_rows() == 0) {
343343
originalTable = makeEmptyTable("EMPTY", typename metadata::base_table_t::persistent_columns_t{});
344344
}
@@ -370,7 +370,7 @@ bool prepareDelayedOutput(ProcessingContext& context, T& defines)
370370
defines.recompile();
371371
}
372372
using metadata = o2::aod::MetadataTrait<o2::aod::Hash<T::spawnable_t::ref.desc_hash>>::metadata;
373-
auto originalTable = soa::ArrowHelpers::joinTables( framework::extractTablesFromRecord(context.inputs(), defines.requiredInputs | std::views::transform([](auto const& input){ return DataSpecUtils::asConcreteDataMatcher(input); }) ) );
373+
auto originalTable = soa::ArrowHelpers::joinTables(framework::extractTablesFromRecord(context.inputs(), defines.requiredInputs | std::views::transform([](auto const& input) { return DataSpecUtils::asConcreteDataMatcher(input); })));
374374
if (originalTable->num_rows() == 0) {
375375
originalTable = makeEmptyTable<metadata::base_table_t::ref>();
376376
}
@@ -622,7 +622,7 @@ bool replaceOrigin(T& preslice, header::DataOrigin const& newOrigin = header::Da
622622
template <is_preslice_group T>
623623
bool replaceOrigin(T& presliceGroup, header::DataOrigin const& newOrigin)
624624
{
625-
homogeneous_apply_refs<true>([&newOrigin](auto& preslice){ return replaceOrigin(preslice, newOrigin); }, presliceGroup);
625+
homogeneous_apply_refs<true>([&newOrigin](auto& preslice) { return replaceOrigin(preslice, newOrigin); }, presliceGroup);
626626
return true;
627627
}
628628

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ struct AnalysisDataProcessorBuilder {
276276
template <soa::is_table_or_iterator T, int AI>
277277
static auto extract(InputRecord& record, std::vector<InputInfo> iInfos, std::vector<ExpressionInfo>& infos, size_t phash)
278278
{
279-
auto matchers = std::ranges::find_if(iInfos, [&phash](auto const& info) { return info.hash == phash; })->matchers
280-
| std::views::filter([](auto const& pair) { return pair.first == AI; });
279+
auto matchers = std::ranges::find_if(iInfos, [&phash](auto const& info) { return info.hash == phash; })->matchers | std::views::filter([](auto const& pair) { return pair.first == AI; });
281280
if constexpr (soa::is_filtered<T>) {
282281
return extractFilteredFromRecord<T>(record, matchers, *std::ranges::find_if(infos, [&phash](ExpressionInfo const& i) { return (i.processHash == phash && i.argumentIndex == AI); }));
283282
} else {
@@ -562,7 +561,7 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
562561
}
563562

564563
// update OutputSpecs in output declarations
565-
homogeneous_apply_refs_sized<numElements>([&newOrigin](auto& element){ return analysis_task_parsers::updateOutputSpec(element, newOrigin); }, *task.get());
564+
homogeneous_apply_refs_sized<numElements>([&newOrigin](auto& element) { return analysis_task_parsers::updateOutputSpec(element, newOrigin); }, *task.get());
566565

567566
// append outputs
568567
homogeneous_apply_refs_sized<numElements>([&outputs, &hash](auto& element) { return analysis_task_parsers::appendOutput(outputs, element, hash); }, *task.get());
@@ -574,7 +573,7 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
574573
homogeneous_apply_refs_sized<numElements>([&requiredServices](auto& element) { return analysis_task_parsers::addService(requiredServices, element); }, *task.get());
575574

576575
// replace origins in Preslice declarations
577-
homogeneous_apply_refs_sized<numElements>([&newOrigin](auto& element){ return analysis_task_parsers::replaceOrigin(element, newOrigin); }, *task.get());
576+
homogeneous_apply_refs_sized<numElements>([&newOrigin](auto& element) { return analysis_task_parsers::replaceOrigin(element, newOrigin); }, *task.get());
578577

579578
auto algo = AlgorithmSpec::InitCallback{[task = task, expressionInfos, inputInfos, newOrigin, newOriginStr](InitContext& ic) mutable {
580579
Cache bindingsKeys;
@@ -623,13 +622,13 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
623622
*task.get());
624623

625624
/// replace origin in slicing caches
626-
std::ranges::transform(bindingsKeys, bindingsKeys.begin(), [&newOrigin](Entry& entry){
625+
std::ranges::transform(bindingsKeys, bindingsKeys.begin(), [&newOrigin](Entry& entry) {
627626
if ((entry.matcher.origin == header::DataOrigin{"AOD"}) && (newOrigin != header::DataOrigin{"AOD"})) {
628627
entry.matcher = replaceOrigin(entry.matcher, newOrigin);
629628
}
630629
return entry;
631630
});
632-
std::ranges::transform(bindingsKeysUnsorted, bindingsKeysUnsorted.begin(), [&newOrigin](Entry& entry){
631+
std::ranges::transform(bindingsKeysUnsorted, bindingsKeysUnsorted.begin(), [&newOrigin](Entry& entry) {
633632
if ((entry.matcher.origin == header::DataOrigin{"AOD"}) && (newOrigin != header::DataOrigin{"AOD"})) {
634633
entry.matcher = replaceOrigin(entry.matcher, newOrigin);
635634
}

Framework/Core/src/AnalysisDataModelHelpers.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ std::string getTreeName(header::DataHeader dh, bool wasAOD)
3636
}
3737

3838
// add prefix according to origin
39-
if (wasAOD || std::ranges::any_of(framework::AODOrigins, [&o = dh.dataOrigin](header::DataOrigin const& origin){ return o == origin; })) {
40-
treeName = "O2" + treeName;
39+
if (wasAOD || std::ranges::any_of(framework::AODOrigins, [&o = dh.dataOrigin](header::DataOrigin const& origin) { return o == origin; })) {
40+
treeName = "O2" + treeName;
4141
}
4242

4343
// exceptions from this

Framework/Core/src/AnalysisSupportHelpers.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ void AnalysisSupportHelpers::addMissingOutputsToBuilder(std::vector<InputSpec> c
174174
additionalInputs | sinks::update_input_list{publisher.inputs}; // update publisher inputs
175175
// FIXME: until we have a single list of pairs
176176
additionalInputs |
177-
std::ranges::views::filter([](InputSpec const& input){
178-
return DataSpecUtils::partialMatch(input, AODOrigins) || std::ranges::any_of(input.metadata, [](ConfigParamSpec const& p){
177+
std::ranges::views::filter([](InputSpec const& input) {
178+
return DataSpecUtils::partialMatch(input, AODOrigins) || std::ranges::any_of(input.metadata, [](ConfigParamSpec const& p) {
179179
return p.name.starts_with("aod-origin-replaced");
180180
});
181181
}) |

Framework/Core/src/ArrowSupport.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
711711
// update currently requested AODs
712712
for (auto& d : workflow) {
713713
d.inputs |
714-
std::ranges::views::filter([](InputSpec const& input){
715-
return DataSpecUtils::partialMatch(input, AODOrigins) || std::ranges::any_of(input.metadata, [](ConfigParamSpec const& p){
714+
std::ranges::views::filter([](InputSpec const& input) {
715+
return DataSpecUtils::partialMatch(input, AODOrigins) || std::ranges::any_of(input.metadata, [](ConfigParamSpec const& p) {
716716
return p.name.starts_with("aod-origin-replaced");
717717
});
718718
}) |

0 commit comments

Comments
 (0)