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

CLI: progress bar added for verdi storage maintain with disk_object_store backend #6562

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

khsrali
Copy link
Contributor

@khsrali khsrali commented Sep 3, 2024

This is the complementary PR for aiidateam/disk-objectstore#171

Now one can easily test the changes here, as @giovannipizzi and @unkcpz requested.

Note

This PR should only merge after the one mentioned above, for this reason I marked this one as draft.
Also I should remember to tag and update the dependency,

Note 2

Don't worry about test failing, it's only because it depends on a released version of disk-objectstore
Ideally for testing, you can pull the PR and install with pip install -e .

@unkcpz
Copy link
Member

unkcpz commented Sep 4, 2024

Thanks @khsrali. The change makes sense, but I think it need a flag for verdi storage maintain to trigger this (or better as the default flag). Otherwise change the log level to show the progress is not very convenient.

@khsrali
Copy link
Contributor Author

khsrali commented Sep 4, 2024

I think it need a flag for verdi storage maintain to trigger this (or better as the default flag). Otherwise change the log level to show the progress is not very convenient.

I tried to stay with same convention of verdi see for instance:
verdi archive import, verdi archive migrate, and verdi archive create in cmd_archive.py they do the same.
The progress bar is shown in the default log level, which is good for baby users.
And of course if an advanced users is so annoyed by it, they can simply set it off in the log level.

@unkcpz
Copy link
Member

unkcpz commented Sep 4, 2024

Okay, then can you move the change from backend to cmd module as in cmd_archive.py

@khsrali
Copy link
Contributor Author

khsrali commented Sep 4, 2024

Okay, then can you move the change from backend to cmd module as in cmd_archive.py

ok, pls check now.

@khsrali
Copy link
Contributor Author

khsrali commented Sep 4, 2024

Actually, I don't like it now, spreading everything in separate files really reduces the readability of the code.
Note the context manager should remain in the backend, as that's the right use of it.

Copy link
Contributor

@agoscinski agoscinski left a comment

Choose a reason for hiding this comment

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

My main question about the position of set_progress_bar_tqdm is: Should a user coming from the Python API also see the progress bar? If yes, then this needs to be in maintain. Maybe one can stick for this PR with the consistency, if one does not have an answer to this question.

src/aiida/cmdline/commands/cmd_storage.py Show resolved Hide resolved
@khsrali
Copy link
Contributor Author

khsrali commented Sep 17, 2024

My main question about the position of set_progress_bar_tqdm is: Should a user coming from the Python API also see the progress bar? If yes, then this needs to be in maintain. Maybe one can stick for this PR with the consistency, if one does not have an answer to this question.

Agreed.

@khsrali khsrali marked this pull request as ready for review September 19, 2024 07:33
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.85%. Comparing base (ef60b66) to head (0f5411c).
Report is 115 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/cmdline/commands/cmd_storage.py 83.34% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6562      +/-   ##
==========================================
+ Coverage   77.51%   77.85%   +0.35%     
==========================================
  Files         560      566       +6     
  Lines       41444    42049     +605     
==========================================
+ Hits        32120    32734     +614     
+ Misses       9324     9315       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@khsrali
Copy link
Contributor Author

khsrali commented Sep 19, 2024

yeah, yeah, CI fails because disck-objectstore v1.1.1 cannot be found in conda-forge
Opened a PR on that conda-forge/disk-objectstore-feedstock#5

@khsrali
Copy link
Contributor Author

khsrali commented Sep 20, 2024

@agoscinski I see mypy is complaining:

src/aiida/orm/utils/serialize.py:51: error: Unused "type: ignore[assignment]" comment  [unused-ignore]
Found 1 error in 1 file (checked 784 source files)

But I've not changed this file at all.. ? 🤔

This is crazy, I run it local by removing assignment, and then it complains 🙃

src/aiida/orm/utils/serialize.py:51: error: Incompatible types in assignment (expression has type "Union[str, int, float, None]", variable has type "str")  [assignment]
src/aiida/orm/utils/serialize.py:51: note: Error code "assignment" not covered by "type: ignore" comment
Found 1 error in 1 file (checked 1 source file)

Update all requirements files........................(no files to check)Skipped
Validate environment.yml.............................(no files to check)Skipped
Automatically generating verdi docs..................(no files to check)Skipped

@GeigerJ2
Copy link
Contributor

src/aiida/orm/utils/serialize.py:51: error: Unused "type: ignore[assignment]" comment  [unused-ignore]
Found 1 error in 1 file (checked 784 source files)

I was actually having exactly the same error on my other PR #6565...

pyproject.toml Outdated
@@ -23,7 +23,7 @@ dependencies = [
'circus~=0.18.0',
'click-spinner~=0.1.8',
'click~=8.1',
'disk-objectstore~=1.1',
'disk-objectstore~=1.1.1',
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need to change this. We don't want to pin the patch version. Same for the environment.yml above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @unkcpz for the review

I understand that disk-objectstore~=1.1 would automatically install the latest patch release.
However, I think it's better to clearly specify the minimum compatible version, as 1.1.0 is not compatible.

This is important because if a user already has disk-objectstore v1.1.0 installed and loses internet access during the installation of aiida-core, the installation will proceed with disk-objectstore v1.1.0 without requiring it to update to 1.1.1.
In that case, we have a wrong installation, with no warning or whatsoever that leads to a bunch of errors emerging during the runtime.

Copy link
Member

@unkcpz unkcpz Sep 25, 2024

Choose a reason for hiding this comment

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

as 1.1.0 is not compatible.

What you mean by "not compatible"? If it is a release that have problem then maybe we need to bring it down from pypi. If 1.1.1 is just adding new feature then having v1.1.0 should be fine I guess? Maybe I miss something?

Copy link
Member

@unkcpz unkcpz Sep 25, 2024

Choose a reason for hiding this comment

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

Ah, I see. The implementation here is rely on the change with the release 1.1.1.
Then if we follow the semver ("MINOR version when you add functionality in a backward compatible manner"), that one should be released as a minor version bump.
I don't know how much we want to follow the semantic versioning. The problem with pinning to patch version is if we bring new things in the future to disk-objectstore and release as 1.2 or higher, it is always needed to bump the version in aiida-core and make release to bring it to user which may not ideal.

Copy link
Member

Choose a reason for hiding this comment

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

I just did a read on https://github.com/aiidateam/AEP/blob/master/002_dependency_management/readme.md again.
If we gonna to follow it, then we probably need to release v1.2 and using ~=1.2 in aiida-core.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand that should have been released as 1.2.
But now, given the situation I don't really think we need to re-release disk-objectstore just to follow semantic versioning thing.

Time and effort it requires, does payoff for the fruit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @unkcpz has a point. We cannot fix this anymore backwards, but lets at least to quickly a release.
aiidateam/disk-objectstore#177

Since not every package is our control I would just do a comment an the dependencies, but since we can make quickly a release, I would fix it, because this has to happen anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then please also fix these as well:

  • plumpy~=0.22.3
  • kiwipy[rmq]~=0.8.4
  • archive-path~=0.4.2
  • click-spinner~=0.1.8
  • upf_to_json~=0.9.2

you may re-release kiwipy, plumpy, and archive-path

Copy link
Contributor

Choose a reason for hiding this comment

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

I can understand the frustration, but that is not in the scope of this PR to solve other peoples mistakes, but in this case we did a wrong release.

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

@khsrali just one minor request, all good then. Thanks!

pyproject.toml Outdated Show resolved Hide resolved
@@ -42,7 +42,7 @@ debugpy==1.6.7
decorator==5.1.1
defusedxml==0.7.1
deprecation==2.1.0
disk-objectstore==1.1.0
disk-objectstore==1.1.1
Copy link
Contributor

@agoscinski agoscinski Sep 26, 2024

Choose a reason for hiding this comment

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

Suggested change
disk-objectstore==1.1.1
disk-objectstore~=1.2

Copy link
Member

Choose a reason for hiding this comment

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

This file (and other requirements below) are initially generated by pip-compile and the version is sepcific to patch version, so it needs to be 1.2.0.

Copy link
Member

Choose a reason for hiding this comment

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

Just a thought in my mind, I think pip-compile --extra=atomic_tools --extra=docs --extra=notebook --extra=rest --extra=tests --no-annotate --output-file=requirements/requirements-py-3.9.txt pyproject.toml command to generate this file needs to be run by CI when there are dependencies changes in project.toml. Anyway not related to this PR.

Copy link
Contributor

@agoscinski agoscinski Sep 26, 2024

Choose a reason for hiding this comment

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

Ah I see these are lock files. Thanks will undo this

Copy link
Contributor

@agoscinski agoscinski Sep 26, 2024

Choose a reason for hiding this comment

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

Yes or a pre-commit hook that checks diff (which is then basically run by the CI^^)

Copy link
Member

Choose a reason for hiding this comment

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

pre-commit ... Seems you didn't success on pushing to move away from it 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

promise aiida-core 3.0 no pre-commit

environment.yml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@unkcpz
Copy link
Member

unkcpz commented Sep 26, 2024

My main question about the position of set_progress_bar_tqdm is: Should a user coming from the Python API also see the progress bar? If yes, then this needs to be in maintain

I missed the comment here, sorry. I think @agoscinski here hit the point, the context manager should appear not in the backend so there is more control on whether to show the progress or not.

Note the context manager should remain in the backend, as that's the right use of it.

@khsrali this I may not agree, if you look at with open(), it is usually used directly. Sorry, I mess up the concept of context management you mentioned. Here we are talking about logging level.

@agoscinski agoscinski force-pushed the for_disk_object_store branch from a14681e to e1475af Compare September 26, 2024 10:34
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Should all good now I guess? Thanks @khsrali @agoscinski!

@khsrali khsrali force-pushed the for_disk_object_store branch from e1475af to 0f5411c Compare September 26, 2024 14:03
@khsrali khsrali merged commit c7c289d into aiidateam:main Sep 26, 2024
26 checks passed
@khsrali khsrali deleted the for_disk_object_store branch September 26, 2024 14:13
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.

4 participants