Skip to content

Commit

Permalink
Merge pull request #622 from jay-m-dev/delete-dataset-check-ai
Browse files Browse the repository at this point in the history
Add a check for ai.status before deleting datasets
  • Loading branch information
jay-m-dev authored Oct 3, 2023
2 parents 15d7abf + 1ea9dbb commit 949d678
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lab/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 949d678

Please sign in to comment.