From 1ea9dbb0a06d06789ff7d073908d609da8813645 Mon Sep 17 00:00:00 2001 From: Jay Moran Date: Tue, 3 Oct 2023 12:30:11 -0700 Subject: [PATCH] Add a check for ai.status before deleting datasets --- lab/lab.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lab/lab.js b/lab/lab.js index 41c2fce21..76859382b 100644 --- a/lab/lab.js +++ b/lab/lab.js @@ -639,6 +639,10 @@ app.delete('/api/v1/datasets/:id', async (req, res, next) => { if (dataset == null) { return res.status(404).send({ message: 'dataset ' + req.params.id + ' not found'}); } + + if (dataset.ai && (dataset.ai.status == recommenderStatus.RUNNING || dataset.ai.status == recommenderStatus.INITIALIZING)) { + return res.status(409).send({message: 'cannot delete dataset, recommender running'}); + } const dataset_file_id = db.toObjectID(dataset.files[0]._id); files.push(...dataset.files);