Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --in-place flag to verdi export migrate #4220

Merged
merged 3 commits into from
Sep 11, 2020

Conversation

ltalirz
Copy link
Member

@ltalirz ltalirz commented Jul 6, 2020

Fixes #4233
Fixes #4322

When export migration is required, you often want to get rid of the outdated
export file.
The --in-place flag saves users from specifying a temporary filename,
removing the old file and renaming the temporary one.

This commit also changes the exit code for migrating an export file that
already is up to date from an error to success (0).

@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

Merging #4220 into develop will decrease coverage by 0.02%.
The diff coverage is 82.36%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4220      +/-   ##
===========================================
- Coverage    79.34%   79.32%   -0.01%     
===========================================
  Files          468      468              
  Lines        34737    34752      +15     
===========================================
+ Hits         27558    27565       +7     
- Misses        7179     7187       +8     
Flag Coverage Δ
#django 72.95% <82.36%> (-0.01%) ⬇️
#sqlalchemy 72.15% <82.36%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/cmdline/commands/cmd_export.py 90.45% <82.36%> (-2.94%) ⬇️
aiida/engine/daemon/client.py 72.42% <0.00%> (-1.14%) ⬇️
aiida/transports/plugins/local.py 81.29% <0.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec32fbb...e29be36. Read the comment docs.

@ltalirz ltalirz requested review from CasperWA and sphuber July 6, 2020 15:53
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks @ltalirz some small changes

tests/cmdline/commands/test_export.py Outdated Show resolved Hide resolved
aiida/tools/importexport/common/archive.py Outdated Show resolved Hide resolved
tests/cmdline/commands/test_export.py Show resolved Hide resolved
tests/cmdline/commands/test_export.py Show resolved Hide resolved
aiida/cmdline/commands/cmd_export.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_export.py Outdated Show resolved Hide resolved
@ltalirz ltalirz requested a review from sphuber August 26, 2020 10:05
@ltalirz ltalirz force-pushed the export-migration branch 2 times, most recently from f96ca55 to 20c44bb Compare August 26, 2020 10:25
Copy link
Contributor

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Seems fine to me.

I have some suggested updates to parts of the tests, nothing serious.
What's more serious is that you are effectively implementing/changing two things in this PR, one is adding the --in-place flag option, but then you're also changing expected behaviour of the migration functionality.
The latter might be fine, but where has this change been discussed?

aiida/cmdline/commands/cmd_export.py Outdated Show resolved Hide resolved
tests/cmdline/commands/test_export.py Show resolved Hide resolved
tests/cmdline/commands/test_export.py Outdated Show resolved Hide resolved
tests/cmdline/commands/test_export.py Outdated Show resolved Hide resolved
tests/cmdline/commands/test_export.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_export.py Show resolved Hide resolved
@ltalirz
Copy link
Member Author

ltalirz commented Aug 30, 2020

@sphuber This should be ready for review

ltalirz and others added 2 commits September 7, 2020 14:07
When export migration is required, you can often get rid of the outdated
export file.
The `--in-place` flag saves users from specifying a temporary filename,
removing the old file and renaming the temporary one.
Using a temporary directory avoids the use of protected tempfile
functions and guarantees that there are no filename clashes.

This commit also changes the exit code for migrating an export file that
already is up to date from an error to success (0).

Co-authored-by: Sebastiaan Huber <mail@sphuber.net>
Co-authored-by: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com>
@sphuber sphuber merged commit d1bc513 into aiidateam:develop Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants