diff --git a/frontend/src/pages/train/[train_space_id].tsx b/frontend/src/pages/train/[train_space_id].tsx index 105d022a..f22d507b 100644 --- a/frontend/src/pages/train/[train_space_id].tsx +++ b/frontend/src/pages/train/[train_space_id].tsx @@ -45,7 +45,7 @@ const TrainSpace = () => { const { train_space_id } = useRouter().query; const { data, isLoading, refetch, error } = useGetTrainspaceQuery({ trainspaceId: train_space_id, - withResults: true + withResults: true, }); const user = useAppSelector((state) => state.currentUser.user); @@ -65,7 +65,9 @@ const TrainSpace = () => { return <>; } - const charts = mapTrainResultsDataToCharts(data.trainspace.detailedTrainResultsData); + const charts = mapTrainResultsDataToCharts( + data.trainspace.detailedTrainResultsData + ); return (
@@ -73,7 +75,7 @@ const TrainSpace = () => {

{train_space_id}

{charts.map((chart) => ( - + {chart} ))} diff --git a/frontend/src/pages/train/metrics_to_charts.tsx b/frontend/src/pages/train/metrics_to_charts.tsx index 90da9adc..3e863a9d 100644 --- a/frontend/src/pages/train/metrics_to_charts.tsx +++ b/frontend/src/pages/train/metrics_to_charts.tsx @@ -56,8 +56,8 @@ const mapMetricToAucRocPlot = (metric: AucRocChart) => { }, ...(metric.values.map((x) => ({ name: `(AUC: ${x[2]})`, - x: x[0] as number[], - y: x[1] as number[], + x: x[0], + y: x[1], type: "scatter", })) as Data[]), ]} @@ -77,55 +77,57 @@ const mapMetricToAucRocPlot = (metric: AucRocChart) => { }; const mapMetricToConfusionMatrixPlot = (metric: ConfusionMatrixChart) => { - - row.map((_, j) => ({ - xref: "x1" as XAxisName, - yref: "y1" as YAxisName, - x: j, - y: (i + metric.values.length - 1) % metric.values.length, - text: metric.values[ - (i + metric.values.length - 1) % metric.values.length - ][j].toString(), - font: { - color: - metric.values[ - (i + metric.values.length - 1) % metric.values.length - ][j] > 0 - ? "white" - : "black", - }, - showarrow: false, - })) - ) - .flat(), - paper_bgcolor: "rgba(0,0,0,0)", - plot_bgcolor: "rgba(0,0,0,0)", - }} - />; + return ( + + row.map((_, j) => ({ + xref: "x1" as XAxisName, + yref: "y1" as YAxisName, + x: j, + y: (i + metric.values.length - 1) % metric.values.length, + text: metric.values[ + (i + metric.values.length - 1) % metric.values.length + ][j].toString(), + font: { + color: + metric.values[ + (i + metric.values.length - 1) % metric.values.length + ][j] > 0 + ? "white" + : "black", + }, + showarrow: false, + })) + ) + .flat(), + paper_bgcolor: "rgba(0,0,0,0)", + plot_bgcolor: "rgba(0,0,0,0)", + }} + /> + ); }; export { diff --git a/training/Dockerfile b/training/Dockerfile index e7631e2c..f1b3c0ef 100644 --- a/training/Dockerfile +++ b/training/Dockerfile @@ -1,4 +1,4 @@ -FROM condaforge/miniforge3 AS base +FROM condaforge/miniforge3:24.1.2-0 AS base WORKDIR /usr/src/build @@ -30,7 +30,7 @@ RUN mamba run --live-stream -n dlp poetry install # we previously mounted training/ to APP_HOME WORKDIR $APP_HOME -RUN chown -R app:app $APP_HOME +RUN chown -R app:app "$APP_HOME" USER app CMD mamba run --live-stream -n dlp poetry run python manage.py runserver 0.0.0.0:8000 @@ -47,7 +47,7 @@ RUN mamba run --live-stream -n dlp poetry install --without dev WORKDIR $APP_HOME COPY . $APP_HOME -RUN chown -R app:app $APP_HOME +RUN chown -R app:app "$APP_HOME" USER app CMD mamba run --live-stream -n dlp gunicorn training.wsgi:application --bind 0.0.0.0:8000 \ No newline at end of file diff --git a/training/training/celery_app.py b/training/training/celery_app.py index 3a443c70..210dec07 100644 --- a/training/training/celery_app.py +++ b/training/training/celery_app.py @@ -7,10 +7,12 @@ @celery_app.task(name="tabularTrainTask") -def tabularTrainTask(tabularParams: dict, trainspaceId: str, uid: str): +def tabularTrainTask(tabularParams: dict, uid: str): + # implementation located in worker.py pass @celery_app.task(name="imageTrainTask") -def imageTrainTask(imageParams: dict, trainspaceId: str, uid: str): +def imageTrainTask(imageParams: dict, uid: str): + # implementation located in worker.py pass diff --git a/training/training/core/celery/Dockerfile b/training/training/core/celery/Dockerfile index 84d0238a..ece91a2b 100644 --- a/training/training/core/celery/Dockerfile +++ b/training/training/core/celery/Dockerfile @@ -1,4 +1,4 @@ -FROM condaforge/miniforge3 AS base +FROM condaforge/miniforge3:24.1.2-0 AS base WORKDIR /usr/src/build @@ -17,7 +17,7 @@ RUN addgroup --system app && adduser --system --group app # create the appropriate directories ARG HOME=/home/app ARG APP_HOME=/home/app/training -RUN mkdir $APP_HOME +RUN mkdir "$APP_HOME" @@ -30,7 +30,7 @@ RUN mamba run --live-stream -n dlp poetry install # we previously mounted training/ to APP_HOME WORKDIR $APP_HOME -RUN chown -R app:app $APP_HOME +RUN chown -R app:app "$APP_HOME" USER app CMD mamba run --live-stream -n dlp celery -A training.core.celery.worker worker --loglevel=INFO @@ -45,7 +45,7 @@ RUN mamba run --live-stream -n dlp poetry install --without dev WORKDIR $APP_HOME COPY . $APP_HOME -RUN chown -R app:app $APP_HOME +RUN chown -R app:app "$APP_HOME" USER app CMD mamba run --live-stream -n dlp celery -A training.core.celery.worker worker --loglevel=INFO diff --git a/training/training/routes/image/image.py b/training/training/routes/image/image.py index e46136dc..203641d7 100644 --- a/training/training/routes/image/image.py +++ b/training/training/routes/image/image.py @@ -3,15 +3,12 @@ from training.core.authenticator import FirebaseAuth, Request from training.celery_app import celery_app -import uuid - router = Router() @router.post("", auth=FirebaseAuth()) def imageTrain(request: Request, imageParams: ImageParams): - trainspaceId = str(uuid.uuid4()) - task = celery_app.send_task( + celery_app.send_task( "imageTrainTask", [imageParams.dict(), request.auth["uid"]] ) diff --git a/training/training/routes/tabular/tabular.py b/training/training/routes/tabular/tabular.py index 097edfaf..621205e5 100644 --- a/training/training/routes/tabular/tabular.py +++ b/training/training/routes/tabular/tabular.py @@ -11,7 +11,7 @@ @router.post("", auth=FirebaseAuth()) def tabularTrain(request: Request, tabularParams: TabularParams): - task = celery_app.send_task( + celery_app.send_task( "tabularTrainTask", [tabularParams.dict(), request.auth["uid"]] )