aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

`verdi computer delete` should allow user to delete computers with associated nodes

Open ltalirz opened this issue 2 years ago • 3 comments

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).

ltalirz avatar Feb 25 '22 11:02 ltalirz

Just ran into this issue again...

ltalirz avatar May 25 '22 20:05 ltalirz

@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..

khsrali avatar Mar 19 '24 08:03 khsrali

Sure, I think it makes sense to add this. I would propose the following:

  1. Add a check in the command whether the computer has any associated nodes.
  2. 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)
  3. If confirmed, delete the nodes first, and then delete the computer
  4. Add a --force flag to bypass the confirmation

sphuber avatar Mar 19 '24 09:03 sphuber