From aa1d7388350d31430d8a9f5f7216c6a31b96299e Mon Sep 17 00:00:00 2001 From: Gabriel Moreira Date: Mon, 4 Nov 2024 17:05:54 +0100 Subject: [PATCH] fix: stop MLJson generation if RunRegistry has no OPEN runs --- .../src/views/machineLearning/jsonPortal.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/machineLearning/jsonPortal.jsx b/frontend/src/views/machineLearning/jsonPortal.jsx index 8d423aa..a683633 100644 --- a/frontend/src/views/machineLearning/jsonPortal.jsx +++ b/frontend/src/views/machineLearning/jsonPortal.jsx @@ -157,7 +157,7 @@ const JsonPortal = () => { }, [activeModels, datasetRegex, rrClassName, rrDatasetName]) useEffect(() => { - const fetchBrilLumiByRun = () => { + const fetchElegibleBrilRuns = () => { API.brilws.brilcalc .lumi({ beamStatus: brilBeamStatus, @@ -182,8 +182,8 @@ const JsonPortal = () => { }) } - if (rrOpenRuns !== undefined) { - fetchBrilLumiByRun() + if (rrOpenRuns !== undefined && rrOpenRuns.length > 0) { + fetchElegibleBrilRuns() } }, [rrOpenRuns]) @@ -458,16 +458,21 @@ const JsonPortal = () => { {activeModels === undefined && (
- Fetching the active ML models... + Fetching active ML models...
)} {datasetIds === undefined && (
- {`Fetching data ids for pattern: ${datasetRegex}`} + {`Fetching dataset ids for pattern: ${datasetRegex}`}
)} - {rrOpenRuns !== undefined && brilRuns === undefined && ( + {rrOpenRuns !== undefined && rrOpenRuns.length === 0 && ( +
+ {`There are no OPEN runs in Run Registry for (${rrClassName}, ${rrDatasetName}), thus no ML JSON will be generated.`} +
+ )} + {rrOpenRuns !== undefined && rrOpenRuns.length > 0 && brilRuns === undefined && (
{`Fetching luminosity data from Bril for ${rrOpenRuns.length} runs.`}