Skip to content

Commit

Permalink
Merge branch 'main' into mboulais/O2B-1373/store-run-type-from-enviro…
Browse files Browse the repository at this point in the history
…nment-configuration
  • Loading branch information
martinboulais authored Sep 19, 2024
2 parents e97086e + 32cc957 commit 81cffac
Show file tree
Hide file tree
Showing 41 changed files with 1,100 additions and 301 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ All notable changes to this project will be documented in this file. See [standa
## [0.65.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%400.65.0)

* Notable changes for users:
* LHC fill details statistics rely on stableBeamEnd as end of run, not stableBeamStart + duration
* LHC fill details statistics rely on stableBeamsEnd as end of run, not stableBeamsStart + duration
* A button to create a log is now available in LHC fill details page
* Run edition justification inputs are now visually similar to other inputs
* Fixed bug for filtering tags using "or"
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apk add --no-cache \
chromium=119.0.6045.159-r0 \
freetype=2.13.0-r5 \
freetype-dev=2.13.0-r5 \
git=2.40.1-r0 \
harfbuzz=7.3.0-r0 \
ca-certificates=20240226-r0

Expand Down
2 changes: 1 addition & 1 deletion lib/database/adapters/DataPassAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class DataPassAdapter {
name,
skimmingStage,
versions: (versions ?? []).map(this.dataPassVersionAdapter.toEntity),
runsCount,
pdpBeamType,
runsCount,
simulationPassesCount,
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* 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.
*/

'use strict';

const { Sequelize } = require('sequelize');

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: (queryInterface) => queryInterface.addColumn('data_passes_runs', 'ready_for_skimming', {
type: Sequelize.BOOLEAN,
allowNull: true,
}),

down: (queryInterface) => queryInterface.removeColumn('data_passes_runs', 'ready_for_skimming'),
};
44 changes: 44 additions & 0 deletions lib/database/models/dataPassRun.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* 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.
*/

const Sequelize = require('sequelize');

module.exports = (sequelize) => {
const DataPassRun = sequelize.define(
'DataPassRun',
{
dataPassId: {
type: Sequelize.INTEGER,
primaryKey: true,
},
runNumber: {
type: Sequelize.INTEGER,
primaryKey: true,
},
readyForSkimming: {
type: Sequelize.BOOLEAN,
allowNull: true,
},
},
{ tableName: 'data_passes_runs' },
);

DataPassRun.removeAttribute('id');

DataPassRun.associate = (models) => {
DataPassRun.belongsTo(models.DataPass);
DataPassRun.belongsTo(models.Run, { sourceKey: 'runNumber', foreignKey: 'runNumber' });
};

return DataPassRun;
};
2 changes: 2 additions & 0 deletions lib/database/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const Attachment = require('./attachment');
const DataPass = require('./dataPass.js');
const DataPassQcFlag = require('./dataPassQcFlag.js');
const DataPassRun = require('./dataPassRun.js');
const DataPassVersion = require('./dataPassVersion.js');
const DataPassVersionStatus = require('./dataPassVersionStatus.js');
const Detector = require('./detector');
Expand Down Expand Up @@ -52,6 +53,7 @@ module.exports = (sequelize) => {
Attachment: Attachment(sequelize),
DataPass: DataPass(sequelize),
DataPassQcFlag: DataPassQcFlag(sequelize),
DataPassRun: DataPassRun(sequelize),
DataPassVersion: DataPassVersion(sequelize),
DataPassVersionStatus: DataPassVersionStatus(sequelize),
Detector: Detector(sequelize),
Expand Down
30 changes: 30 additions & 0 deletions lib/database/repositories/DataPassRunRepository.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @license
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
* See http://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.
*/

const { models: { DataPassRun } } = require('..');
const Repository = require('./Repository');

/**
* Sequelize implementation of the DataPassRunRepository.
*/
class DataPassRunRepository extends Repository {
/**
* Creates a new `DataPassRunRepository` instance.
*/
constructor() {
super(DataPassRun);
}
}

module.exports = new DataPassRunRepository();
2 changes: 2 additions & 0 deletions lib/database/repositories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const AttachmentRepository = require('./AttachmentRepository');
const DataPassRepository = require('./DataPassRepository.js');
const DataPassQcFlagRepository = require('./DataPassQcFlagRepository.js');
const DataPassRunRepository = require('./DataPassRunRepository');
const DataPassVersionRepository = require('./DataPassVersionRepository.js');
const DataPassVersionStatusRepository = require('./DataPassVersionStatusRepository.js');
const DetectorRepository = require('./DetectorRepository');
Expand Down Expand Up @@ -56,6 +57,7 @@ module.exports = {
AttachmentRepository,
DataPassRepository,
DataPassQcFlagRepository,
DataPassRunRepository,
DataPassVersionRepository,
DataPassVersionStatusRepository,
DetectorRepository,
Expand Down
2 changes: 1 addition & 1 deletion lib/database/seeders/20230124105627-environment-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = {
},
{
environment_id: 'GIDO1jdkD',
status: 'DESTROYED',
status: 'DONE',
status_message: 'Environment has been destroyed',
created_at: new Date('2019-08-09 14:10:00'),
updated_at: new Date('2019-08-09 14:10:00'),
Expand Down
43 changes: 23 additions & 20 deletions lib/database/seeders/20240112102011-data-passes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,41 @@
*/

const { DataPassVersionStatus } = require('../../domain/enums/DataPassVersionStatus');
const { SkimmingStage } = require('../../domain/enums/SkimmingStage');

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface) =>
queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.bulkInsert('data_passes', [

/** LHC22b */
/** LHC22b (proton-proton)*/
{
id: 1,
name: 'LHC22b_apass1',
skimming_stage: SkimmingStage.SKIMMABLE,
lhc_period_id: 2,
created_at: '2024-01-10 11:00:00',
updated_at: '2024-01-10 11:00:00',
},
{
id: 2,
name: 'LHC22b_apass2',
name: 'LHC22b_skimming',
skimming_stage: SkimmingStage.SKIMMING,
lhc_period_id: 2,
created_at: '2024-01-10 11:00:00',
updated_at: '2024-01-10 11:00:00',
},
{
id: 5,
name: 'LHC22b_apass2_skimmed',
skimming_stage: SkimmingStage.SKIMMED,
lhc_period_id: 2,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

/** LHC22a */

/** LHC22a (PbPb) */
{
id: 3,
name: 'LHC22a_apass1',
Expand All @@ -46,21 +56,14 @@ module.exports = {
},
{
id: 4,
name: 'LHC22a_skimming',
name: 'LHC22a_apass2',
lhc_period_id: 1,
created_at: '2024-02-11 10:00:00',
updated_at: '2024-02-11 10:00:00',
},
{
id: 5,
name: 'LHC22a_apass2_skimmed',
lhc_period_id: 1,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},
], { transaction });

queryInterface.bulkInsert('data_pass_versions', [
await queryInterface.bulkInsert('data_pass_versions', [
{
id: 1,
data_pass_id: 1,
Expand All @@ -74,7 +77,7 @@ module.exports = {
{
id: 2,
data_pass_id: 2,
description: 'Some random desc 2',
description: 'desc LHC24b skimming',
reconstructed_events_count: 50848604,
output_size: 55765671112610,
last_seen: 55,
Expand All @@ -95,22 +98,22 @@ module.exports = {
{
id: 4,
data_pass_id: 4,
description: 'LHC22a skimming',
description: 'LHC22a',
last_seen: 105,
created_at: '2024-02-11 10:00:00',
updated_at: '2024-02-11 10:00:00',
},
{
id: 5,
data_pass_id: 5,
description: 'LHC22a skimmed',
description: 'LHC22b skimmed',
last_seen: 105,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},
], { transaction }),

queryInterface.bulkInsert('data_pass_version_status_history', [
await queryInterface.bulkInsert('data_pass_version_status_history', [

/**
* In Bkp/RCT whole history of data_pass's processing is stored
Expand Down Expand Up @@ -197,9 +200,9 @@ module.exports = {
], { transaction }),

await queryInterface.bulkInsert('data_passes_runs', [
{ data_pass_id: 1, run_number: 106 },
{ data_pass_id: 1, run_number: 107 },
{ data_pass_id: 1, run_number: 108 },
{ data_pass_id: 1, run_number: 106, ready_for_skimming: true },
{ data_pass_id: 1, run_number: 107, ready_for_skimming: false },
{ data_pass_id: 1, run_number: 108, ready_for_skimming: false },
{ data_pass_id: 2, run_number: 1 },
{ data_pass_id: 2, run_number: 2 },
{ data_pass_id: 2, run_number: 55 },
Expand Down
2 changes: 1 addition & 1 deletion lib/database/seeders/20240125141211-simulation-passes.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {

queryInterface.bulkInsert('simulation_pass_data_pass_anchors', [
{ data_pass_id: 1, simulation_pass_id: 1 },
{ data_pass_id: 2, simulation_pass_id: 1 },
{ data_pass_id: 5, simulation_pass_id: 1 },

{ data_pass_id: 3, simulation_pass_id: 2 },
{ data_pass_id: 3, simulation_pass_id: 3 },
Expand Down
19 changes: 19 additions & 0 deletions lib/domain/enums/PdpBeamType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* 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.
*/

const PdpBeamType = Object.freeze({
PROTON_PROTON: 'pp',
LEAD_LEAD: 'PbPb',
});

module.exports = { PdpBeamType };
19 changes: 19 additions & 0 deletions lib/public/domain/enums/SkimmingStage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* 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.
*/

export const SkimmingStage = Object.freeze({
SKIMMABLE: 'Skimmable',
SKIMMING: 'Skimming',
SKIMMED: 'Skimmed',
POST_SKIMMED: 'PostSkimmed',
});
33 changes: 33 additions & 0 deletions lib/public/utilities/fetch/jsonPatch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* 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.
*/

import { jsonFetch } from './jsonFetch.js';

/**
* Send the given body as JSON PATCH request to the server and return the result parsed from JSON
*
* @param {string} endpoint the remote endpoint to send request to
* @param {string|object} body the body of the request to send
* @return {Promise<*>} resolves with the result parsed from JSON
*/
export const jsonPatch = (endpoint, body) => {
if (typeof body !== 'string') {
body = JSON.stringify(body);
}

return jsonFetch(endpoint, {
method: 'PATCH',
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body,
});
};
Loading

0 comments on commit 81cffac

Please sign in to comment.