Skip to content

Fix bug in delete_nodes when passing pks of non-existing nodes#2440

Merged
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2439_delete_nodes_not_existing
Feb 8, 2019
Merged

Fix bug in delete_nodes when passing pks of non-existing nodes#2440
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2439_delete_nodes_not_existing

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented Feb 1, 2019

Fixes #2439

The aiida.manage.database.delete.nodes.delete_nodes function was not
checking whether the pks that were passed correspond to existing nodes
which would cause the line that fetches the repository folders, after
the graph traversal queries had been completed, to except. To fix this
we first verify that the passed pks exist and if not print a warning and
discard them.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 1, 2019

Coverage Status

Coverage increased (+0.02%) to 69.777% when pulling 802f5ba on sphuber:fix_2439_delete_nodes_not_existing into 4378d52 on aiidateam:provenance_redesign.

@sphuber sphuber force-pushed the fix_2439_delete_nodes_not_existing branch from eb8d826 to 1ecefe6 Compare February 8, 2019 08:09
@sphuber sphuber requested a review from giovannipizzi February 8, 2019 08:11
Comment thread aiida/manage/database/delete/nodes.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use click.echo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't touch that part, but might as well, you are right

The `aiida.manage.database.delete.nodes.delete_nodes` function was not
checking whether the pks that were passed correspond to existing nodes
which would cause the line that fetches the repository folders, after
the graph traversal queries had been completed, to except. To fix this
we first verify that the passed pks exist and if not print a warning and
discard them.
@sphuber sphuber force-pushed the fix_2439_delete_nodes_not_existing branch from 1ecefe6 to 802f5ba Compare February 8, 2019 10:48
@sphuber
Copy link
Copy Markdown
Contributor Author

sphuber commented Feb 8, 2019

@giovannipizzi Changed print to use echo or echo_warning where applicable and also replaced input with click.confirm.

@sphuber sphuber merged commit bdb7983 into aiidateam:provenance_redesign Feb 8, 2019
@sphuber sphuber deleted the fix_2439_delete_nodes_not_existing branch February 8, 2019 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants