From 0bda0a58cd2190b416b848583839bb6cc85246a0 Mon Sep 17 00:00:00 2001 From: Martin Boulais <31805063+martinboulais@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:20:36 +0100 Subject: [PATCH 1/2] [O2B-1427] Store trigger configuration per runs --- cxx-client/CMakeLists.txt | 3 ++ .../example/exampleSpecificServices.cxx | 6 ++- cxx-client/include/BookkeepingApi/BkpClient.h | 5 +++ .../include/BookkeepingApi/RunServiceClient.h | 29 +++++++++++++ cxx-client/src/grpc/GrpcBkpClient.cxx | 7 ++++ cxx-client/src/grpc/GrpcBkpClient.h | 3 ++ .../grpc/services/GrpcQcFlagServiceClient.cxx | 3 -- .../grpc/services/GrpcRunServiceClient.cxx | 41 +++++++++++++++++++ .../src/grpc/services/GrpcRunServiceClient.h | 38 +++++++++++++++++ lib/database/adapters/RunAdapter.js | 3 ++ ...210110228-add-trigger-raw-configuration.js | 17 ++++++++ lib/database/models/run.js | 5 +++ lib/database/models/typedefs/SequelizeRun.js | 1 + lib/database/seeders/20200713103855-runs.js | 1 + lib/domain/dtos/UpdateRunByRunNumberDto.js | 1 + lib/domain/entities/Run.js | 1 + .../views/Runs/Details/RunDetailsModel.js | 1 + .../views/Runs/Details/runDetailsComponent.js | 16 ++++++++ proto/common.proto | 1 + proto/run.proto | 2 + test/api/runs.test.js | 2 + .../server/services/run/RunService.test.js | 15 ++++++- .../lib/usecases/run/UpdateRunUseCase.test.js | 2 + test/public/runs/detail.test.js | 7 ++++ 24 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 cxx-client/include/BookkeepingApi/RunServiceClient.h create mode 100644 cxx-client/src/grpc/services/GrpcRunServiceClient.cxx create mode 100644 cxx-client/src/grpc/services/GrpcRunServiceClient.h create mode 100644 lib/database/migrations/20250210110228-add-trigger-raw-configuration.js diff --git a/cxx-client/CMakeLists.txt b/cxx-client/CMakeLists.txt index 3f7c52aaf3..db5ea7730b 100644 --- a/cxx-client/CMakeLists.txt +++ b/cxx-client/CMakeLists.txt @@ -67,6 +67,9 @@ add_library(BookkeepingApi SHARED include/BookkeepingApi/TriggerCountersServiceClient.h src/grpc/services/GrpcTriggerCountersServiceClient.h src/grpc/services/GrpcTriggerCountersServiceClient.cxx + include/BookkeepingApi/RunServiceClient.h + src/grpc/services/GrpcRunServiceClient.h + src/grpc/services/GrpcRunServiceClient.cxx ) target_include_directories(BookkeepingApi diff --git a/cxx-client/example/exampleSpecificServices.cxx b/cxx-client/example/exampleSpecificServices.cxx index 43a4b36360..463a43c50c 100644 --- a/cxx-client/example/exampleSpecificServices.cxx +++ b/cxx-client/example/exampleSpecificServices.cxx @@ -36,7 +36,7 @@ int main(int argc, char** argv) // Test QC flag creation auto dataPassQcFlagIds = client->qcFlag()->createForDataPass( 55, - "LHC22b_apass2", + "skimming", "FT0", { { 2, 1565280000000, 1565287200000, "FT0/Check" }, { .flagTypeId = 11, .origin = "FT0/task" } }); @@ -65,6 +65,10 @@ int main(int argc, char** argv) std::cout << "Successfully created trigger counters" << std::endl; client->triggerCounters()->createOrUpdateForRun(108, "CLASS-NAME", 1234, 10, 20, 30, 40, 50, 60); std::cout << "Successfully updated trigger counters" << std::endl; + + // Test run update + client->run()->setRawTriggerConfiguration(1, "A\nnew raw\nconfiguration"); + std::cout << "Successfully updated run raw configuration" << std::endl; } catch (std::runtime_error& error) { std::cerr << "An error occurred: " << error.what() << std::endl; exit(2); diff --git a/cxx-client/include/BookkeepingApi/BkpClient.h b/cxx-client/include/BookkeepingApi/BkpClient.h index 7ee6524728..7dd947fede 100644 --- a/cxx-client/include/BookkeepingApi/BkpClient.h +++ b/cxx-client/include/BookkeepingApi/BkpClient.h @@ -17,6 +17,7 @@ #include "DplProcessExecutionClient.h" #include "QcFlagServiceClient.h" #include "TriggerCountersServiceClient.h" +#include "RunServiceClient.h" namespace o2::bkp::api { @@ -35,7 +36,11 @@ class BkpClient /// Returns the client for QcFlag service virtual const std::unique_ptr& qcFlag() const = 0; + /// Returns the client for trigger counters virtual const std::unique_ptr& triggerCounters() const = 0; + + /// Returns the client for runs + virtual const std::unique_ptr& run() const = 0; }; } // namespace o2::bkp::api diff --git a/cxx-client/include/BookkeepingApi/RunServiceClient.h b/cxx-client/include/BookkeepingApi/RunServiceClient.h new file mode 100644 index 0000000000..3c008d6968 --- /dev/null +++ b/cxx-client/include/BookkeepingApi/RunServiceClient.h @@ -0,0 +1,29 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// + +#ifndef CXX_CLIENT_BOOKKEEPINGAPI_RUNSERVICECLIENT_H +#define CXX_CLIENT_BOOKKEEPINGAPI_RUNSERVICECLIENT_H + +#include + +namespace o2::bkp::api +{ +class RunServiceClient +{ + public: + virtual ~RunServiceClient() = default; + + virtual void setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) = 0; +}; +} // namespace o2::bkp::api + +#endif // CXX_CLIENT_BOOKKEEPINGAPI_RUNSERVICECLIENT_H diff --git a/cxx-client/src/grpc/GrpcBkpClient.cxx b/cxx-client/src/grpc/GrpcBkpClient.cxx index 4ab1eef018..d366b7d66f 100644 --- a/cxx-client/src/grpc/GrpcBkpClient.cxx +++ b/cxx-client/src/grpc/GrpcBkpClient.cxx @@ -16,6 +16,7 @@ #include "grpc/services/GrpcDplProcessExecutionClient.h" #include "grpc/services/GrpcQcFlagServiceClient.h" #include "grpc/services/GrpcTriggerCountersServiceClient.h" +#include "grpc/services/GrpcRunServiceClient.h" using grpc::Channel; @@ -34,6 +35,7 @@ using services::GrpcDplProcessExecutionClient; using services::GrpcFlpServiceClient; using services::GrpcQcFlagServiceClient; using services::GrpcTriggerCountersServiceClient; +using services::GrpcRunServiceClient; GrpcBkpClient::GrpcBkpClient(const string& uri) { @@ -42,6 +44,7 @@ GrpcBkpClient::GrpcBkpClient(const string& uri) mDplProcessExecutionClient = make_unique(channel); mQcFlagClient = make_unique(channel); mTriggerCountersClient = make_unique(channel); + mRunClient = make_unique(channel); } const unique_ptr& GrpcBkpClient::flp() const @@ -63,4 +66,8 @@ const unique_ptr& GrpcBkpClient::triggerCounters() { return mTriggerCountersClient; } + +const unique_ptr& GrpcBkpClient::run() const { + return mRunClient; +} } // namespace o2::bkp::api::grpc diff --git a/cxx-client/src/grpc/GrpcBkpClient.h b/cxx-client/src/grpc/GrpcBkpClient.h index 0cd85a8bce..19785dbac6 100644 --- a/cxx-client/src/grpc/GrpcBkpClient.h +++ b/cxx-client/src/grpc/GrpcBkpClient.h @@ -32,11 +32,14 @@ class GrpcBkpClient : public o2::bkp::api::BkpClient const std::unique_ptr& triggerCounters() const override; + const std::unique_ptr& run() const override; + private: std::unique_ptr<::o2::bkp::api::FlpServiceClient> mFlpClient; std::unique_ptr<::o2::bkp::api::DplProcessExecutionClient> mDplProcessExecutionClient; std::unique_ptr<::o2::bkp::api::QcFlagServiceClient> mQcFlagClient; std::unique_ptr<::o2::bkp::api::TriggerCountersServiceClient> mTriggerCountersClient; + std::unique_ptr<::o2::bkp::api::RunServiceClient> mRunClient; }; } // namespace o2::bkp::api::grpc diff --git a/cxx-client/src/grpc/services/GrpcQcFlagServiceClient.cxx b/cxx-client/src/grpc/services/GrpcQcFlagServiceClient.cxx index c17d9a47ad..9ff2864fe4 100644 --- a/cxx-client/src/grpc/services/GrpcQcFlagServiceClient.cxx +++ b/cxx-client/src/grpc/services/GrpcQcFlagServiceClient.cxx @@ -8,9 +8,6 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// -// Created by mboulais on 27/05/24. -// #include "GrpcQcFlagServiceClient.h" diff --git a/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx b/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx new file mode 100644 index 0000000000..34bf636e6a --- /dev/null +++ b/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx @@ -0,0 +1,41 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// + +#include "GrpcRunServiceClient.h" + +#include + +using grpc::ClientContext; + +using o2::bookkeeping::RunUpdateRequest; +using o2::bookkeeping::Run; + +namespace o2::bkp::api::grpc::services +{ +GrpcRunServiceClient::GrpcRunServiceClient(const std::shared_ptr<::grpc::ChannelInterface>& channel) +{ + mStub = o2::bookkeeping::RunService::NewStub(channel); +} +void GrpcRunServiceClient::setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) { + ClientContext context{}; + RunUpdateRequest updateRequest{}; + Run updatedRun; + + updateRequest.set_runnumber(runNumber); + updateRequest.set_triggerrawconfiguration(rawTriggerConfiguration); + + auto status = mStub->Update(&context, updateRequest, &updatedRun); + if (!status.ok()) { + throw std::runtime_error(status.error_message()); + } +} +} // namespace o2::bkp::api::grpc::services diff --git a/cxx-client/src/grpc/services/GrpcRunServiceClient.h b/cxx-client/src/grpc/services/GrpcRunServiceClient.h new file mode 100644 index 0000000000..d3f3ec14d7 --- /dev/null +++ b/cxx-client/src/grpc/services/GrpcRunServiceClient.h @@ -0,0 +1,38 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// + +#ifndef CXX_CLIENT_BOOKKEEPINGAPI_GRPCRUNERVICECLIENT_H +#define CXX_CLIENT_BOOKKEEPINGAPI_GRPCRUNERVICECLIENT_H + +#include "run.grpc.pb.h" +#include "BookkeepingApi/RunServiceClient.h" + +#include + +namespace o2::bkp::api::grpc::services +{ + +class GrpcRunServiceClient : public RunServiceClient +{ + public: + explicit GrpcRunServiceClient(const std::shared_ptr<::grpc::ChannelInterface>& channel); + ~GrpcRunServiceClient() override = default; + + void setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) override; + + private: + std::unique_ptr mStub; +}; + +} // namespace o2::bkp::api::grpc::services + +#endif // CXX_CLIENT_BOOKKEEPINGAPI_GRPCRUNERVICECLIENT_H diff --git a/lib/database/adapters/RunAdapter.js b/lib/database/adapters/RunAdapter.js index 5da3a896c1..30765813e9 100644 --- a/lib/database/adapters/RunAdapter.js +++ b/lib/database/adapters/RunAdapter.js @@ -158,6 +158,7 @@ class RunAdapter { crossSection, triggerEfficiency, triggerAcceptance, + triggerRawConfiguration, phaseShiftAtStartBeam1, phaseShiftAtStartBeam2, phaseShiftAtEndBeam1, @@ -230,6 +231,7 @@ class RunAdapter { crossSection, triggerEfficiency, triggerAcceptance, + triggerRawConfiguration, phaseShiftAtStartBeam1, phaseShiftAtStartBeam2, phaseShiftAtEndBeam1, @@ -347,6 +349,7 @@ class RunAdapter { crossSection: entityObject.crossSection, triggerEfficiency: entityObject.triggerEfficiency, triggerAcceptance: entityObject.triggerAcceptance, + triggerRawConfiguration: entityObject.triggerRawConfiguration, phaseShiftAtStartBeam1: entityObject.phaseShiftAtStartBeam1, phaseShiftAtStartBeam2: entityObject.phaseShiftAtStartBeam2, phaseShiftAtEndBeam1: entityObject.phaseShiftAtEndBeam1, diff --git a/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js b/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js new file mode 100644 index 0000000000..ed5ef3d56b --- /dev/null +++ b/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js @@ -0,0 +1,17 @@ +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + up: async (queryInterface, Sequelize) => await queryInterface.addColumn( + 'runs', + 'trigger_raw_configuration', + { + type: Sequelize.DataTypes.TEXT, + allowNull: true, + default: null, + after: 'trigger_acceptance', + }, + ), + + down: async (queryInterface) => await queryInterface.removeColumn('runs', 'trigger_raw_configuration'), +}; diff --git a/lib/database/models/run.js b/lib/database/models/run.js index 0f7de6fd80..cf15a2e113 100644 --- a/lib/database/models/run.js +++ b/lib/database/models/run.js @@ -260,6 +260,11 @@ module.exports = (sequelize) => { allowNull: true, default: null, }, + triggerRawConfiguration: { + type: Sequelize.TEXT, + allowNull: true, + default: null, + }, phaseShiftAtStartBeam1: { type: Sequelize.DECIMAL, allowNull: true, diff --git a/lib/database/models/typedefs/SequelizeRun.js b/lib/database/models/typedefs/SequelizeRun.js index 4d9630a2ee..6f77769cd8 100644 --- a/lib/database/models/typedefs/SequelizeRun.js +++ b/lib/database/models/typedefs/SequelizeRun.js @@ -75,6 +75,7 @@ * @property {number|null} crossSection * @property {number|null} triggerEfficiency * @property {number|null} triggerAcceptance + * @property {string|null} triggerRawConfiguration * @property {number|null} phaseShiftAtEndBeam1 * @property {number|null} phaseShiftAtEndBeam2 * @property {number|null} phaseShiftAtStartBeam1 diff --git a/lib/database/seeders/20200713103855-runs.js b/lib/database/seeders/20200713103855-runs.js index 410baa994d..4e6c52abeb 100644 --- a/lib/database/seeders/20200713103855-runs.js +++ b/lib/database/seeders/20200713103855-runs.js @@ -58,6 +58,7 @@ module.exports = { cross_section: 1.23, trigger_efficiency: 2.34, trigger_acceptance: 3.45, + trigger_raw_configuration: 'Raw\nTrigger\nConfiguration', phase_shift_at_start_beam1: 4.56, phase_shift_at_start_beam2: -1.23, phase_shift_at_end_beam1: 5.67, diff --git a/lib/domain/dtos/UpdateRunByRunNumberDto.js b/lib/domain/dtos/UpdateRunByRunNumberDto.js index 1440c49943..cff4a27ec2 100644 --- a/lib/domain/dtos/UpdateRunByRunNumberDto.js +++ b/lib/domain/dtos/UpdateRunByRunNumberDto.js @@ -41,6 +41,7 @@ const BodyDto = Joi.object({ crossSection: Joi.number().optional(), triggerEfficiency: Joi.number().optional(), triggerAcceptance: Joi.number().optional(), + triggerRawConfiguration: Joi.string().optional(), phaseShiftAtStart: PhaseShiftDto, phaseShiftAtEnd: PhaseShiftDto, }); diff --git a/lib/domain/entities/Run.js b/lib/domain/entities/Run.js index 2736078457..3fff2d8243 100644 --- a/lib/domain/entities/Run.js +++ b/lib/domain/entities/Run.js @@ -74,6 +74,7 @@ * @property {number|null} crossSection * @property {number|null} triggerEfficiency * @property {number|null} triggerAcceptance + * @property {string|null} triggerRawConfiguration * @property {number|null} phaseShiftAtStartBeam1 * @property {number|null} phaseShiftAtStartBeam2 * @property {number|null} phaseShiftAtEndBeam1 diff --git a/lib/public/views/Runs/Details/RunDetailsModel.js b/lib/public/views/Runs/Details/RunDetailsModel.js index ee7d1d2dcc..770ce2635e 100644 --- a/lib/public/views/Runs/Details/RunDetailsModel.js +++ b/lib/public/views/Runs/Details/RunDetailsModel.js @@ -26,6 +26,7 @@ export const RUN_DETAILS_PANELS_KEYS = { FLPS: 'flps', DPL_PROCESSES: 'dpl-processes', TRIGGER_COUNTERS: 'trigger-counters', + TRIGGER_CONFIGURATION: 'trigger-configuration', }; /** diff --git a/lib/public/views/Runs/Details/runDetailsComponent.js b/lib/public/views/Runs/Details/runDetailsComponent.js index bd43345f6a..66f6bb31e9 100644 --- a/lib/public/views/Runs/Details/runDetailsComponent.js +++ b/lib/public/views/Runs/Details/runDetailsComponent.js @@ -65,6 +65,12 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel. onclick: () => router.go('?page=run-overview'), }, 'Return to Overview'), ]), + + /** + * Run details display + * @param {Run} run run to be displayed + * @return {Component} the run details + */ Success: (run) => { if (!router.params.runNumber) { const targetPanel = router.params.panel ?? runDetailsModel.tabbedPanelModel.currentPanelKey ?? 'logs'; @@ -510,6 +516,7 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel. [RUN_DETAILS_PANELS_KEYS.FLPS]: 'FLP statistics', [RUN_DETAILS_PANELS_KEYS.DPL_PROCESSES]: 'QC/PDP tasks', [RUN_DETAILS_PANELS_KEYS.TRIGGER_COUNTERS]: 'Trigger counters', + [RUN_DETAILS_PANELS_KEYS.TRIGGER_CONFIGURATION]: 'Trigger Config', }, { [RUN_DETAILS_PANELS_KEYS.LOGS]: (dataLogs) => table(dataLogs, logsActiveColumns, null, { profile: 'embeded' }), @@ -593,6 +600,15 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel. }, { classes: 'table-sm' }, ), + [RUN_DETAILS_PANELS_KEYS.TRIGGER_CONFIGURATION]: () => h( + PanelComponent, + h( + '.p2', + run.triggerRawConfiguration + .split('\n') + .map((row) => h('', row)), + ), + ), }, )), ]; diff --git a/proto/common.proto b/proto/common.proto index b64ed28afa..1794a215f8 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -92,6 +92,7 @@ message Run { optional int64 timeTrgStart = 21; // Trigger value optional string triggerValue = 22; + optional string triggerRawConfiguration = 32; // The full name or file location of the odcTopology optional string odcTopologyFullName = 23; optional bool ddFlp = 24; diff --git a/proto/run.proto b/proto/run.proto index 52e86bec63..9b3485c95e 100644 --- a/proto/run.proto +++ b/proto/run.proto @@ -52,6 +52,7 @@ message RunUpdateRequest { optional int64 timeTrgStart = 5; optional int64 timeTrgEnd = 6; optional string triggerValue = 7; + optional string triggerRawConfiguration = 19; optional string pdpConfigOption = 8; optional string pdpTopologyDescriptionLibraryFile = 9; optional string tfbDdMode = 10; @@ -64,6 +65,7 @@ message RunUpdateRequest { // Optional users that stopped or started the run (can also be undefined) optional User userO2Start = 17; optional User userO2Stop = 18; + // 19 is trigger raw configuration } // Enums diff --git a/test/api/runs.test.js b/test/api/runs.test.js index 4d639bb158..28c04021a9 100644 --- a/test/api/runs.test.js +++ b/test/api/runs.test.js @@ -1226,6 +1226,7 @@ module.exports = () => { crossSection: 0.1, triggerEfficiency: 0.2, triggerAcceptance: 0.3, + triggerRawConfiguration: 'Trigger\nRaw\nConfiguration', phaseShiftAtStart: { beam1: 0.4, beam2: -0.2, @@ -1258,6 +1259,7 @@ module.exports = () => { expect(data.nTfOrbits).to.equal(BIG_INT_NUMBER); expect(data.triggerEfficiency).to.equal(0.2); expect(data.triggerAcceptance).to.equal(0.3); + expect(data.triggerRawConfiguration).to.equal('Trigger\nRaw\nConfiguration'); expect(data.phaseShiftAtStartBeam1).to.equal(0.4); expect(data.phaseShiftAtStartBeam2).to.equal(-0.2); expect(data.phaseShiftAtEndBeam1).to.equal(0.5); diff --git a/test/lib/server/services/run/RunService.test.js b/test/lib/server/services/run/RunService.test.js index 59ed33c343..ef60e395ea 100644 --- a/test/lib/server/services/run/RunService.test.js +++ b/test/lib/server/services/run/RunService.test.js @@ -662,7 +662,7 @@ module.exports = () => { expect(run.phaseShiftAtEndBeam2).to.equal(-0.0002); }); - it('should successfully update run cross section and trigger acceptance', async () => { + it('should successfully update run cross-section and trigger acceptance', async () => { const runNumber = 1; const run = await runService.update( { runNumber }, @@ -679,6 +679,19 @@ module.exports = () => { expect(run.triggerAcceptance).to.equal(0.0003); }); + it('Should successfully update run raw trigger configuration', async () => { + const runNumber = 1; + const run = await runService.update( + { runNumber }, + { + runPatch: { + triggerRawConfiguration: 'Raw\nTrigger\nConfiguration', + }, + }, + ); + expect(run.triggerRawConfiguration).to.equal('Raw\nTrigger\nConfiguration'); + }); + it('should fetch distinct aliceCurrent levels', async () => { const levelsCombinations = await runService.getAllAliceL3AndDipoleLevelsForPhysicsRuns(); expect(levelsCombinations).have.all.deep.members([{ l3Level: 20003, dipoleLevel: 0 }, { l3Level: 30003, dipoleLevel: 0 }]); diff --git a/test/lib/usecases/run/UpdateRunUseCase.test.js b/test/lib/usecases/run/UpdateRunUseCase.test.js index 838283a46e..84bd177f9e 100644 --- a/test/lib/usecases/run/UpdateRunUseCase.test.js +++ b/test/lib/usecases/run/UpdateRunUseCase.test.js @@ -62,6 +62,7 @@ module.exports = () => { crossSection: 0.1, triggerEfficiency: 0.2, triggerAcceptance: 0.3, + triggerRawConfiguration: 'Raw\nTrigger\nConfiguration', phaseShiftAtStart: { beam1: 0.4, beam2: -0.1, @@ -329,6 +330,7 @@ module.exports = () => { expect(result.crossSection).to.equal(0.1); expect(result.triggerEfficiency).to.equal(0.2); expect(result.triggerAcceptance).to.equal(0.3); + expect(result.triggerRawConfiguration).to.equal('Raw\nTrigger\nConfiguration'); expect(result.phaseShiftAtStartBeam1).to.equal(0.4); expect(result.phaseShiftAtStartBeam2).to.equal(-0.1); expect(result.phaseShiftAtEndBeam1).to.equal(0.5); diff --git a/test/public/runs/detail.test.js b/test/public/runs/detail.test.js index dd05e86c8f..15d37c793a 100644 --- a/test/public/runs/detail.test.js +++ b/test/public/runs/detail.test.js @@ -326,6 +326,13 @@ module.exports = () => { ]); }); + it('should successfully navigate to the trigger configuration panel', async () => { + await goToRunDetails(page, 1); + + await pressElement(page, '#trigger-configuration-tab'); + await expectInnerText(page, '#trigger-configuration-pane .panel', 'Raw\nTrigger\nConfiguration'); + }); + it('should show lhc data in normal mode', async () => { await expectInnerText(page, '#fill-number', 'Fill 5'); }); From 1ceab238059034127b9d09c88c8747ac2a738a0f Mon Sep 17 00:00:00 2001 From: martinboulais <31805063+martinboulais@users.noreply.github.com> Date: Tue, 11 Feb 2025 09:16:06 +0100 Subject: [PATCH 2/2] Rename to CTP trigger configuration --- cxx-client/example/exampleSpecificServices.cxx | 4 ++-- cxx-client/include/BookkeepingApi/RunServiceClient.h | 2 +- cxx-client/src/grpc/services/GrpcRunServiceClient.cxx | 4 ++-- cxx-client/src/grpc/services/GrpcRunServiceClient.h | 2 +- lib/database/adapters/RunAdapter.js | 6 +++--- .../20250210110228-add-trigger-raw-configuration.js | 4 ++-- lib/database/models/run.js | 2 +- lib/database/models/typedefs/SequelizeRun.js | 2 +- lib/database/seeders/20200713103855-runs.js | 2 +- lib/domain/dtos/UpdateRunByRunNumberDto.js | 2 +- lib/domain/entities/Run.js | 2 +- lib/public/views/Runs/Details/RunDetailsModel.js | 2 +- lib/public/views/Runs/Details/runDetailsComponent.js | 6 +++--- proto/common.proto | 2 +- proto/run.proto | 2 +- test/api/runs.test.js | 4 ++-- test/lib/server/services/run/RunService.test.js | 4 ++-- test/lib/usecases/run/UpdateRunUseCase.test.js | 4 ++-- 18 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cxx-client/example/exampleSpecificServices.cxx b/cxx-client/example/exampleSpecificServices.cxx index 463a43c50c..66fb7f9baa 100644 --- a/cxx-client/example/exampleSpecificServices.cxx +++ b/cxx-client/example/exampleSpecificServices.cxx @@ -67,8 +67,8 @@ int main(int argc, char** argv) std::cout << "Successfully updated trigger counters" << std::endl; // Test run update - client->run()->setRawTriggerConfiguration(1, "A\nnew raw\nconfiguration"); - std::cout << "Successfully updated run raw configuration" << std::endl; + client->run()->setRawCtpTriggerConfiguration(1, "A\nnew raw\nCTP trigger configuration"); + std::cout << "Successfully updated run raw CTP trigger configuration" << std::endl; } catch (std::runtime_error& error) { std::cerr << "An error occurred: " << error.what() << std::endl; exit(2); diff --git a/cxx-client/include/BookkeepingApi/RunServiceClient.h b/cxx-client/include/BookkeepingApi/RunServiceClient.h index 3c008d6968..0673eb06cb 100644 --- a/cxx-client/include/BookkeepingApi/RunServiceClient.h +++ b/cxx-client/include/BookkeepingApi/RunServiceClient.h @@ -22,7 +22,7 @@ class RunServiceClient public: virtual ~RunServiceClient() = default; - virtual void setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) = 0; + virtual void setRawCtpTriggerConfiguration(int runNumber, std::string rawCtpTriggerConfiguration) = 0; }; } // namespace o2::bkp::api diff --git a/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx b/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx index 34bf636e6a..561f0dff42 100644 --- a/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx +++ b/cxx-client/src/grpc/services/GrpcRunServiceClient.cxx @@ -25,13 +25,13 @@ GrpcRunServiceClient::GrpcRunServiceClient(const std::shared_ptr<::grpc::Channel { mStub = o2::bookkeeping::RunService::NewStub(channel); } -void GrpcRunServiceClient::setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) { +void GrpcRunServiceClient::setRawCtpTriggerConfiguration(int runNumber, std::string rawCtpTriggerConfiguration) { ClientContext context{}; RunUpdateRequest updateRequest{}; Run updatedRun; updateRequest.set_runnumber(runNumber); - updateRequest.set_triggerrawconfiguration(rawTriggerConfiguration); + updateRequest.set_rawctptriggerconfiguration(rawCtpTriggerConfiguration); auto status = mStub->Update(&context, updateRequest, &updatedRun); if (!status.ok()) { diff --git a/cxx-client/src/grpc/services/GrpcRunServiceClient.h b/cxx-client/src/grpc/services/GrpcRunServiceClient.h index d3f3ec14d7..736db0b409 100644 --- a/cxx-client/src/grpc/services/GrpcRunServiceClient.h +++ b/cxx-client/src/grpc/services/GrpcRunServiceClient.h @@ -27,7 +27,7 @@ class GrpcRunServiceClient : public RunServiceClient explicit GrpcRunServiceClient(const std::shared_ptr<::grpc::ChannelInterface>& channel); ~GrpcRunServiceClient() override = default; - void setRawTriggerConfiguration(int runNumber, std::string rawTriggerConfiguration) override; + void setRawCtpTriggerConfiguration(int runNumber, std::string rawCtpTriggerConfiguration) override; private: std::unique_ptr mStub; diff --git a/lib/database/adapters/RunAdapter.js b/lib/database/adapters/RunAdapter.js index 30765813e9..e10f251a77 100644 --- a/lib/database/adapters/RunAdapter.js +++ b/lib/database/adapters/RunAdapter.js @@ -158,7 +158,7 @@ class RunAdapter { crossSection, triggerEfficiency, triggerAcceptance, - triggerRawConfiguration, + rawCtpTriggerConfiguration, phaseShiftAtStartBeam1, phaseShiftAtStartBeam2, phaseShiftAtEndBeam1, @@ -231,7 +231,7 @@ class RunAdapter { crossSection, triggerEfficiency, triggerAcceptance, - triggerRawConfiguration, + rawCtpTriggerConfiguration, phaseShiftAtStartBeam1, phaseShiftAtStartBeam2, phaseShiftAtEndBeam1, @@ -349,7 +349,7 @@ class RunAdapter { crossSection: entityObject.crossSection, triggerEfficiency: entityObject.triggerEfficiency, triggerAcceptance: entityObject.triggerAcceptance, - triggerRawConfiguration: entityObject.triggerRawConfiguration, + rawCtpTriggerConfiguration: entityObject.rawCtpTriggerConfiguration, phaseShiftAtStartBeam1: entityObject.phaseShiftAtStartBeam1, phaseShiftAtStartBeam2: entityObject.phaseShiftAtStartBeam2, phaseShiftAtEndBeam1: entityObject.phaseShiftAtEndBeam1, diff --git a/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js b/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js index ed5ef3d56b..b28e3e8f83 100644 --- a/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js +++ b/lib/database/migrations/20250210110228-add-trigger-raw-configuration.js @@ -4,7 +4,7 @@ module.exports = { up: async (queryInterface, Sequelize) => await queryInterface.addColumn( 'runs', - 'trigger_raw_configuration', + 'raw_ctp_trigger_configuration', { type: Sequelize.DataTypes.TEXT, allowNull: true, @@ -13,5 +13,5 @@ module.exports = { }, ), - down: async (queryInterface) => await queryInterface.removeColumn('runs', 'trigger_raw_configuration'), + down: async (queryInterface) => await queryInterface.removeColumn('runs', 'raw_ctp_trigger_configuration'), }; diff --git a/lib/database/models/run.js b/lib/database/models/run.js index cf15a2e113..d1914693a4 100644 --- a/lib/database/models/run.js +++ b/lib/database/models/run.js @@ -260,7 +260,7 @@ module.exports = (sequelize) => { allowNull: true, default: null, }, - triggerRawConfiguration: { + rawCtpTriggerConfiguration: { type: Sequelize.TEXT, allowNull: true, default: null, diff --git a/lib/database/models/typedefs/SequelizeRun.js b/lib/database/models/typedefs/SequelizeRun.js index 6f77769cd8..13b354ff3b 100644 --- a/lib/database/models/typedefs/SequelizeRun.js +++ b/lib/database/models/typedefs/SequelizeRun.js @@ -75,7 +75,7 @@ * @property {number|null} crossSection * @property {number|null} triggerEfficiency * @property {number|null} triggerAcceptance - * @property {string|null} triggerRawConfiguration + * @property {string|null} rawCtpTriggerConfiguration * @property {number|null} phaseShiftAtEndBeam1 * @property {number|null} phaseShiftAtEndBeam2 * @property {number|null} phaseShiftAtStartBeam1 diff --git a/lib/database/seeders/20200713103855-runs.js b/lib/database/seeders/20200713103855-runs.js index 4e6c52abeb..c994bd1f49 100644 --- a/lib/database/seeders/20200713103855-runs.js +++ b/lib/database/seeders/20200713103855-runs.js @@ -58,7 +58,7 @@ module.exports = { cross_section: 1.23, trigger_efficiency: 2.34, trigger_acceptance: 3.45, - trigger_raw_configuration: 'Raw\nTrigger\nConfiguration', + raw_ctp_trigger_configuration: 'Raw\nTrigger\nConfiguration', phase_shift_at_start_beam1: 4.56, phase_shift_at_start_beam2: -1.23, phase_shift_at_end_beam1: 5.67, diff --git a/lib/domain/dtos/UpdateRunByRunNumberDto.js b/lib/domain/dtos/UpdateRunByRunNumberDto.js index cff4a27ec2..ccc2fdac93 100644 --- a/lib/domain/dtos/UpdateRunByRunNumberDto.js +++ b/lib/domain/dtos/UpdateRunByRunNumberDto.js @@ -41,7 +41,7 @@ const BodyDto = Joi.object({ crossSection: Joi.number().optional(), triggerEfficiency: Joi.number().optional(), triggerAcceptance: Joi.number().optional(), - triggerRawConfiguration: Joi.string().optional(), + rawCtpTriggerConfiguration: Joi.string().optional(), phaseShiftAtStart: PhaseShiftDto, phaseShiftAtEnd: PhaseShiftDto, }); diff --git a/lib/domain/entities/Run.js b/lib/domain/entities/Run.js index 3fff2d8243..4fb9788222 100644 --- a/lib/domain/entities/Run.js +++ b/lib/domain/entities/Run.js @@ -74,7 +74,7 @@ * @property {number|null} crossSection * @property {number|null} triggerEfficiency * @property {number|null} triggerAcceptance - * @property {string|null} triggerRawConfiguration + * @property {string|null} rawCtpTriggerConfiguration * @property {number|null} phaseShiftAtStartBeam1 * @property {number|null} phaseShiftAtStartBeam2 * @property {number|null} phaseShiftAtEndBeam1 diff --git a/lib/public/views/Runs/Details/RunDetailsModel.js b/lib/public/views/Runs/Details/RunDetailsModel.js index 770ce2635e..a4ca80f92a 100644 --- a/lib/public/views/Runs/Details/RunDetailsModel.js +++ b/lib/public/views/Runs/Details/RunDetailsModel.js @@ -26,7 +26,7 @@ export const RUN_DETAILS_PANELS_KEYS = { FLPS: 'flps', DPL_PROCESSES: 'dpl-processes', TRIGGER_COUNTERS: 'trigger-counters', - TRIGGER_CONFIGURATION: 'trigger-configuration', + CTP_TRIGGER_CONFIGURATION: 'trigger-configuration', }; /** diff --git a/lib/public/views/Runs/Details/runDetailsComponent.js b/lib/public/views/Runs/Details/runDetailsComponent.js index 66f6bb31e9..b5806a9fb1 100644 --- a/lib/public/views/Runs/Details/runDetailsComponent.js +++ b/lib/public/views/Runs/Details/runDetailsComponent.js @@ -516,7 +516,7 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel. [RUN_DETAILS_PANELS_KEYS.FLPS]: 'FLP statistics', [RUN_DETAILS_PANELS_KEYS.DPL_PROCESSES]: 'QC/PDP tasks', [RUN_DETAILS_PANELS_KEYS.TRIGGER_COUNTERS]: 'Trigger counters', - [RUN_DETAILS_PANELS_KEYS.TRIGGER_CONFIGURATION]: 'Trigger Config', + [RUN_DETAILS_PANELS_KEYS.CTP_TRIGGER_CONFIGURATION]: 'CTP Trigger Config', }, { [RUN_DETAILS_PANELS_KEYS.LOGS]: (dataLogs) => table(dataLogs, logsActiveColumns, null, { profile: 'embeded' }), @@ -600,11 +600,11 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel. }, { classes: 'table-sm' }, ), - [RUN_DETAILS_PANELS_KEYS.TRIGGER_CONFIGURATION]: () => h( + [RUN_DETAILS_PANELS_KEYS.CTP_TRIGGER_CONFIGURATION]: () => h( PanelComponent, h( '.p2', - run.triggerRawConfiguration + run.rawCtpTriggerConfiguration .split('\n') .map((row) => h('', row)), ), diff --git a/proto/common.proto b/proto/common.proto index 1794a215f8..af45e0997d 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -92,7 +92,7 @@ message Run { optional int64 timeTrgStart = 21; // Trigger value optional string triggerValue = 22; - optional string triggerRawConfiguration = 32; + optional string rawCtpTriggerConfiguration = 32; // The full name or file location of the odcTopology optional string odcTopologyFullName = 23; optional bool ddFlp = 24; diff --git a/proto/run.proto b/proto/run.proto index 9b3485c95e..42997cdf22 100644 --- a/proto/run.proto +++ b/proto/run.proto @@ -52,7 +52,7 @@ message RunUpdateRequest { optional int64 timeTrgStart = 5; optional int64 timeTrgEnd = 6; optional string triggerValue = 7; - optional string triggerRawConfiguration = 19; + optional string rawCtpTriggerConfiguration = 19; optional string pdpConfigOption = 8; optional string pdpTopologyDescriptionLibraryFile = 9; optional string tfbDdMode = 10; diff --git a/test/api/runs.test.js b/test/api/runs.test.js index 28c04021a9..0c09da695f 100644 --- a/test/api/runs.test.js +++ b/test/api/runs.test.js @@ -1226,7 +1226,7 @@ module.exports = () => { crossSection: 0.1, triggerEfficiency: 0.2, triggerAcceptance: 0.3, - triggerRawConfiguration: 'Trigger\nRaw\nConfiguration', + rawCtpTriggerConfiguration: 'Trigger\nRaw\nConfiguration', phaseShiftAtStart: { beam1: 0.4, beam2: -0.2, @@ -1259,7 +1259,7 @@ module.exports = () => { expect(data.nTfOrbits).to.equal(BIG_INT_NUMBER); expect(data.triggerEfficiency).to.equal(0.2); expect(data.triggerAcceptance).to.equal(0.3); - expect(data.triggerRawConfiguration).to.equal('Trigger\nRaw\nConfiguration'); + expect(data.rawCtpTriggerConfiguration).to.equal('Trigger\nRaw\nConfiguration'); expect(data.phaseShiftAtStartBeam1).to.equal(0.4); expect(data.phaseShiftAtStartBeam2).to.equal(-0.2); expect(data.phaseShiftAtEndBeam1).to.equal(0.5); diff --git a/test/lib/server/services/run/RunService.test.js b/test/lib/server/services/run/RunService.test.js index ef60e395ea..ac18ff4656 100644 --- a/test/lib/server/services/run/RunService.test.js +++ b/test/lib/server/services/run/RunService.test.js @@ -685,11 +685,11 @@ module.exports = () => { { runNumber }, { runPatch: { - triggerRawConfiguration: 'Raw\nTrigger\nConfiguration', + rawCtpTriggerConfiguration: 'Raw\nTrigger\nConfiguration', }, }, ); - expect(run.triggerRawConfiguration).to.equal('Raw\nTrigger\nConfiguration'); + expect(run.rawCtpTriggerConfiguration).to.equal('Raw\nTrigger\nConfiguration'); }); it('should fetch distinct aliceCurrent levels', async () => { diff --git a/test/lib/usecases/run/UpdateRunUseCase.test.js b/test/lib/usecases/run/UpdateRunUseCase.test.js index 84bd177f9e..8f2fbba002 100644 --- a/test/lib/usecases/run/UpdateRunUseCase.test.js +++ b/test/lib/usecases/run/UpdateRunUseCase.test.js @@ -62,7 +62,7 @@ module.exports = () => { crossSection: 0.1, triggerEfficiency: 0.2, triggerAcceptance: 0.3, - triggerRawConfiguration: 'Raw\nTrigger\nConfiguration', + rawCtpTriggerConfiguration: 'Raw\nTrigger\nConfiguration', phaseShiftAtStart: { beam1: 0.4, beam2: -0.1, @@ -330,7 +330,7 @@ module.exports = () => { expect(result.crossSection).to.equal(0.1); expect(result.triggerEfficiency).to.equal(0.2); expect(result.triggerAcceptance).to.equal(0.3); - expect(result.triggerRawConfiguration).to.equal('Raw\nTrigger\nConfiguration'); + expect(result.rawCtpTriggerConfiguration).to.equal('Raw\nTrigger\nConfiguration'); expect(result.phaseShiftAtStartBeam1).to.equal(0.4); expect(result.phaseShiftAtStartBeam2).to.equal(-0.1); expect(result.phaseShiftAtEndBeam1).to.equal(0.5);