Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 committed Aug 2, 2024
2 parents 5342159 + ca61eba commit 6d76a74
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions runregistry_backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function getLogger(level, originalLogger = console.log) {

// override console log to use timestamp
console.debug = console.log = getLogger("DEBUG")
console.info = getLogger("INFO")
console.warning = getLogger("WARNING")
console.info = getLogger("INFO", console.info)
console.warn = getLogger("WARNING", console.warn)
console.error = getLogger("ERROR", console.error)

// Logging for sanity
Expand Down
1 change: 1 addition & 0 deletions runregistry_backend/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ module.exports = {
'beam1_stable', 'hbhec_ready',
'beam2_stable', 'beam2_present',
'gemp_ready', 'gemm_ready',
'prescale_index', 'prescale_name'
],
oms_lumisection_luminosity_whitelist:
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ exports.get_OMS_lumisections = handleErrors(async (run_number) => {

// We add luminosity information
oms_lumisections = oms_lumisections.map(
({ recorded_lumi, delivered_lumi }, index, oms_lumisections) => {
({ recorded_lumi, delivered_lumi, lumisection_number }, index, oms_lumisections) => {
// Check that the index matches the LS number
if (index + 1 !== lumisection_number) {
console.warn(`Inconsistency in Run ${run_number}: Lumisection ${index} does not match OMS lumisection_number (${lumisection_number})`)
}
// If any of them is null, then the per_lumi are all null
if (recorded_lumi === null || delivered_lumi === null) {
return {
Expand Down
16 changes: 8 additions & 8 deletions runregistry_backend/utils/error_handlers.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Handle Generic Errors:
exports.handleErrors = (fn, error_message) => {
return function(...params) {
return function (...params) {
return fn(...params).catch(err => {
console.log(err);
console.log(error_message, err.message);
console.error(err);
console.error(error_message, err.message);
// console.log(err.stack);
});
};
};

exports.catchAPIError = fn => {
return function(req, res, next) {
return function (req, res, next) {
return fn(req, res, next).catch(next);
};
};
Expand All @@ -19,16 +19,16 @@ exports.catchAPIErrorHotShot = fn => (req, res, next) =>
fn(req, res, next).catch(next);

exports.expressError = (err, req, res, next) => {
console.log(err.message || err);
console.log(err);
console.error(err.message || err);
console.error(err);
res.status(500).json({ err: err.message || err });
};

// We want the error to fail so that a run does not get saved/updated
exports.handleCronErrors = (fn, error_message) => {
return function(...params) {
return function (...params) {
return fn(...params).catch(err => {
console.log(error_message, err.message);
console.error(error_message, err.message);
// console.log(err.stack);
throw err;
});
Expand Down
2 changes: 1 addition & 1 deletion runregistry_frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /usr/src/app

ENV NODE_ENV production
# TODO: remove qa
ENV ENV production_qa
ENV ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# Installing dependencies
COPY package*.json ./
Expand Down
6 changes: 0 additions & 6 deletions runregistry_frontend/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ const config = {
root_url_prefix: '',
api_url: 'https://dev-cmsrunregistry.web.cern.ch/api',
},
// Production Openshift project, used for transitioning
// TODO: Remove
production_qa: {
root_url_prefix: '',
api_url: 'https://cmsrunregistry-qa.web.cern.ch/api',
},
// Production Openshift project
production: {
root_url_prefix: '',
Expand Down
4 changes: 2 additions & 2 deletions runregistry_frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function getLogger(level, originalLogger = console.log) {

// override console log to use timestamp
console.debug = console.log = getLogger("DEBUG")
console.info = getLogger("INFO")
console.warning = getLogger("WARNING")
console.info = getLogger("INFO", console.info)
console.warn = getLogger("WARNING", console.warn)
console.error = getLogger("ERROR", console.error)

app.prepare().then(() => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/runregistry_sso_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import argparse
import requests
from .utils import CernAuthToken
from utils import CernAuthToken

logger = logging.getLogger(__name__)
logging.basicConfig(encoding="utf-8", level=logging.DEBUG)
Expand Down

0 comments on commit 6d76a74

Please sign in to comment.