How to remove corrupted model versions

Solved!
zhlj
Level 2
How to remove corrupted model versions

Hi, 

As you can see from below pictures, one model went wrong. From the Job view, it shows this job failed, and in the saved models, this "half-generated" model sticks here. I can't even find check box on the left. How could I remove it? this model causes an error when looping the saved models with python script. 

Capture.PNG

Thanks, 

Lj

0 Kudos
1 Solution
Andrey
Dataiker Alumni

Hi Lj,

Small addition to your solution: you can type "running" in the filter on the saved model page, then click on a checkbox on the left of the "actions" button to select all of the corrupted versions. Then click Actions -> Delete

Screenshot 2020-06-18 at 01.21.06.png

 

A second solution could be by creating a python notebook and running this snippet (change SAVED_MODEL_ID):

 

import dataiku
import dataikuapi

SAVED_MODEL_ID = '0tqFKYBZ'
pk = dataiku.Project().project_key
c=dataiku.api_client()
p=c.get_project(pk)
m=dataiku.Model(SAVED_MODEL_ID)

sm=dataikuapi.dss.savedmodel.DSSSavedModel(c,pk,SAVED_MODEL_ID)
versions_to_delete = [v['versionId'] for v in m.list_versions() if v['snippet']['trainInfo']['state'] != 'DONE']
sm.delete_versions(versions_to_delete)

 

Regards,

Andrey

Andrey Avtomonov
R&D Engineer @ Dataiku

View solution in original post

3 Replies
zhlj
Level 2
Author

I managed to delete this model. First check the box on the upper left corner to tick on all the model versions, then un-tick all the normal versions, and delete. 

This looks like a small defect, the developer may need to amend this. 

Thanks, 

 Lj

0 Kudos
Andrey
Dataiker Alumni

Hi Lj,

Small addition to your solution: you can type "running" in the filter on the saved model page, then click on a checkbox on the left of the "actions" button to select all of the corrupted versions. Then click Actions -> Delete

Screenshot 2020-06-18 at 01.21.06.png

 

A second solution could be by creating a python notebook and running this snippet (change SAVED_MODEL_ID):

 

import dataiku
import dataikuapi

SAVED_MODEL_ID = '0tqFKYBZ'
pk = dataiku.Project().project_key
c=dataiku.api_client()
p=c.get_project(pk)
m=dataiku.Model(SAVED_MODEL_ID)

sm=dataikuapi.dss.savedmodel.DSSSavedModel(c,pk,SAVED_MODEL_ID)
versions_to_delete = [v['versionId'] for v in m.list_versions() if v['snippet']['trainInfo']['state'] != 'DONE']
sm.delete_versions(versions_to_delete)

 

Regards,

Andrey

Andrey Avtomonov
R&D Engineer @ Dataiku
zhlj
Level 2
Author

Thanks Andrey, both solutions are much more advanced and convenient than my solution. Thanks, really appreciate it.