Function to delete nodes from the database.
delete_nodes(pks, verbosity=0, dry_run=False, force=False, **kwargs)¶
Delete nodes by a list of pks.
This command will delete not only the specified nodes, but also the ones that are linked to these and should be also deleted in order to keep a consistent provenance according to the rules explained in the concepts section of the documentation. In summary:
If a DATA node is deleted, any process nodes linked to it will also be deleted.
2. If a CALC node is deleted, any incoming WORK node (callers) will be deleted as well whereas any incoming DATA node (inputs) will be kept. Outgoing DATA nodes (outputs) will be deleted by default but this can be disabled.
3. If a WORK node is deleted, any incoming WORK node (callers) will be deleted as well, but all DATA nodes will be kept. Outgoing WORK or CALC nodes will be kept by default, but deletion of either of both kind of connected nodes can be enabled.
These rules are ‘recursive’, so if a CALC node is deleted, then its output DATA nodes will be deleted as well, and then any CALC node that may have those as inputs, and so on.
pks – a list of the PKs of the nodes to delete
force (bool) – do not ask for confirmation to delete nodes.
verbosity (int) – 0 prints nothing, 1 prints just sums and total, 2 prints individual nodes.
kwargs – graph traversal rules. See
aiida.common.links.GraphTraversalRuleswhat rule names are toggleable and what the defaults are.
dry_run (bool) – Just perform a dry run and do not delete anything. Print statistics according to the verbosity level set.
force – Do not ask for confirmation to delete nodes.