aiida-core
aiida-core copied to clipboard
`verdi computer delete` should allow user to delete computers with associated nodes
Currently, trying to verdi computer delete
a computer on which calculations have run results in an error like
Message: '\x1b[22mUnable to delete the requested computer: it is possible that there is at least one node using this computer (original message: (psycopg2.errors.NotNullViolation) null value in column "dbcomputer_id" violates not-null constraint\nDETAIL: Failing row contains (1, 1, null, {}, {"safe_interval": 0.0, "use_login_shell": true}, t).\n\n[SQL: UPDATE db_dbauthinfo SET dbcomputer_id=%(dbcomputer_id)s WHERE db_dbauthinfo.id = %(db_dbauthinfo_id)s]\n[parameters: {\'dbcomputer_id\': None, \'db_dbauthinfo_id\': 1}]\n(Background on this error at: https://sqlalche.me/e/14/gkpj))\x1b[0m'
Arguments: ()
A user who wants to delete this computer then has to figure out how to manually delete the nodes on this computer before they can delete the computer itself.
We should simplify this: verdi computer delete
should allow users - with an extra prompt - to delete a computer and all nodes associated it (just as verdi node delete
deletes nodes connected via the provenance).
Just ran into this issue again...
@sphuber do you agree with this? I think it makes sense to do something like verdi computer delete --force
to kill & delete running nodes.
This is again one of those features that could help new users to play around and if something went wrong, easily purge everything..
Sure, I think it makes sense to add this. I would propose the following:
- Add a check in the command whether the computer has any associated nodes.
- If it does, prompt the user to confirm they also want to delete all those nodes (include the number of nodes that would be deleted in the message)
- If confirmed, delete the nodes first, and then delete the computer
- Add a
--force
flag to bypass the confirmation