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

Install pseudos from downloaded files #524

Merged
merged 27 commits into from
Nov 8, 2023
Merged

Conversation

unkcpz
Copy link
Member

@unkcpz unkcpz commented Oct 21, 2023

fixes #490

The relevant changes needed are:

  1. pinging the aiida-pseudo version.
  2. Refactoring the methods in setup_pseudos.py to support flexible parameter passing.

Note that from the test all 8 pseudos seems to only save ~10s but in the place where network condition are bad, this is very helpful.

@unkcpz unkcpz marked this pull request as draft October 21, 2023 16:17
@unkcpz
Copy link
Member Author

unkcpz commented Oct 21, 2023

Slightly blocked by #523 where the modules are restructured.

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (8a550c8) 79.07% compared to head (515bdb3) 80.72%.
Report is 6 commits behind head on main.

❗ Current head 515bdb3 differs from pull request most recent head 9de1dea. Consider uploading reports for the commit 9de1dea to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #524      +/-   ##
==========================================
+ Coverage   79.07%   80.72%   +1.65%     
==========================================
  Files          47       49       +2     
  Lines        3211     3414     +203     
==========================================
+ Hits         2539     2756     +217     
+ Misses        672      658      -14     
Flag Coverage Δ
python-3.10 80.72% <97.68%> (+1.65%) ⬆️
python-3.8 ?
python-3.9 80.76% <97.68%> (+1.65%) ⬆️

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

Files Coverage Δ
src/aiidalab_qe/app/configuration/__init__.py 98.79% <100.00%> (+0.04%) ⬆️
src/aiidalab_qe/app/configuration/advanced.py 98.19% <100.00%> (+0.03%) ⬆️
src/aiidalab_qe/app/configuration/pseudos.py 88.98% <100.00%> (-0.45%) ⬇️
src/aiidalab_qe/app/main.py 98.57% <100.00%> (+2.27%) ⬆️
src/aiidalab_qe/app/structure/__init__.py 98.63% <100.00%> (+0.03%) ⬆️
src/aiidalab_qe/app/submission/__init__.py 81.06% <100.00%> (+1.73%) ⬆️
src/aiidalab_qe/common/panel.py 86.95% <100.00%> (ø)
src/aiidalab_qe/plugins/bands/result.py 94.73% <100.00%> (ø)
...idalab_qe/plugins/electronic_structure/__init__.py 100.00% <100.00%> (ø)
src/aiidalab_qe/plugins/pdos/result.py 92.95% <100.00%> (ø)
... and 13 more

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

@unkcpz unkcpz force-pushed the fix/490/pre-download-pseudos branch from 023346e to 9272b4e Compare October 23, 2023 20:07
@unkcpz
Copy link
Member Author

unkcpz commented Oct 23, 2023

Blocked by aiidateam/aiida-pseudo#165

@unkcpz unkcpz changed the title Pining the lowest version of aiida-pseudo Download pseudos and install later Oct 23, 2023
@unkcpz unkcpz changed the title Download pseudos and install later Install pseudos from downloaded files Oct 23, 2023
@unkcpz unkcpz force-pushed the fix/490/pre-download-pseudos branch from f5a4719 to e728098 Compare October 23, 2023 22:39
@unkcpz unkcpz marked this pull request as ready for review October 24, 2023 16:12
@unkcpz unkcpz force-pushed the fix/490/pre-download-pseudos branch from e3b69f8 to e1c5737 Compare October 25, 2023 10:15
src/aiidalab_qe/common/setup_pseudos.py Outdated Show resolved Hide resolved
src/aiidalab_qe/common/setup_pseudos.py Outdated Show resolved Hide resolved
src/aiidalab_qe/workflows/__init__.py Outdated Show resolved Hide resolved
@unkcpz unkcpz removed the pr/blocked label Oct 25, 2023
@unkcpz
Copy link
Member Author

unkcpz commented Oct 25, 2023

@superstar54, this is ready for review.
The version of pseudo libraries now should only need to be updated in two places for all.
This change also accelerates the first time of start the container ~24s, will be more for server with bad network condition.

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

Great job on working on this feature. It will improve the user experience. I added a few change requests.

docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/before-notebook.d/71_install-qeapp.sh Show resolved Hide resolved
docker/before-notebook.d/71_install-qeapp.sh Show resolved Hide resolved
src/aiidalab_qe/__main__.py Outdated Show resolved Hide resolved
src/aiidalab_qe/common/setup_pseudos.py Outdated Show resolved Hide resolved
if library == "PseudoDojo":
pseudo_family_string = f"PseudoDojo/0.4/{functional}/SR/{accuracy}/upf"
pseudo_family_string = (
f"PseudoDojo/{PSEUDODOJO_VERSION}/{functional}/SR/{accuracy}/upf"
Copy link
Member

Choose a reason for hiding this comment

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

Becareful here. The setup_pseudos in the common folder is something we want to move to the aiidalab-widgets-base, so it's better not to import the PSEUDODOJO_VERSION from the setup_pseudos. The pseudo version is a local configuration parameter belonging to the app itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also thought about this when I moved version and family data class to common/setup_pseudos.py. First of all it has to be moved outside from app/ since if it is inside, it will import app/ which need the profile and can not be called from Dockerfile which doesn't have a profile setup. Second, it fit quite well in the common/, if we move pseudos stuff to let's say aiidalab-widget-base, this PSEUDODOJO_VERSION can be imported from the AWB or if QeApp needs to define its own version, just define it as we did in qeapp.yaml.

Copy link
Member

Choose a reason for hiding this comment

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

Since you already move it outside the app folder, please define the version in the qeapp.yaml.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure it is doable, the SSSP_VERSION is defined in common/setup_pseudos.py which is not in the app module in order to avoid loading profile when calling aiidalab-qe install. The qeapp.yaml is in the app module instead.

Copy link
Member

Choose a reason for hiding this comment

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

in order to avoid loading profile when calling aiidalab-qe install

You mean aiidalab-qe install_pseudos. I checked this function, it needs load the profile at the beginning.

The problem here is: we want to make the setup_pseudos.py as a common function, but it doesn't allow users to customize the pseudos.
I would suggest passing the pseudo info into the install method in the setup_pseudos.py.

src/aiidalab_qe/common/setup_pseudos.py Outdated Show resolved Hide resolved
tests/test_codes.py Show resolved Hide resolved
tests/test_pseudo.py Show resolved Hide resolved
Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

A few small changes are needed.

src/aiidalab_qe/__main__.py Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
if library == "PseudoDojo":
pseudo_family_string = f"PseudoDojo/0.4/{functional}/SR/{accuracy}/upf"
pseudo_family_string = (
f"PseudoDojo/{PSEUDODOJO_VERSION}/{functional}/SR/{accuracy}/upf"
Copy link
Member

Choose a reason for hiding this comment

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

Since you already move it outside the app folder, please define the version in the qeapp.yaml.

Comment on lines +16 to +17
# The command wil first install the dependencies from list by parsing setup config files,
# (for `aiidalab/aiidalab<23.03.2` the `setup.py` should be in the root folder of the app https://github.com/aiidalab/aiidalab/pull/382).
Copy link
Member Author

@unkcpz unkcpz Nov 7, 2023

Choose a reason for hiding this comment

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

I hope this is clear.

Copy link
Member

Choose a reason for hiding this comment

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

What will happen if I git clone the repo and install it using pip?

Copy link
Member Author

Choose a reason for hiding this comment

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

As a developer, you can install it with pip, but from appstore it calls aiidalab install. Here in Dockerfile I use it to test the appstore installation behavior is correct. You can have a look at #532 why I changed it to this to spot the error which not raised before.

@unkcpz unkcpz force-pushed the fix/490/pre-download-pseudos branch from d9cccf6 to 0ea967d Compare November 7, 2023 10:22
Comment on lines +16 to +17
# The command wil first install the dependencies from list by parsing setup config files,
# (for `aiidalab/aiidalab<23.03.2` the `setup.py` should be in the root folder of the app https://github.com/aiidalab/aiidalab/pull/382).
Copy link
Member

Choose a reason for hiding this comment

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

What will happen if I git clone the repo and install it using pip?

if library == "PseudoDojo":
pseudo_family_string = f"PseudoDojo/0.4/{functional}/SR/{accuracy}/upf"
pseudo_family_string = (
f"PseudoDojo/{PSEUDODOJO_VERSION}/{functional}/SR/{accuracy}/upf"
Copy link
Member

Choose a reason for hiding this comment

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

in order to avoid loading profile when calling aiidalab-qe install

You mean aiidalab-qe install_pseudos. I checked this function, it needs load the profile at the beginning.

The problem here is: we want to make the setup_pseudos.py as a common function, but it doesn't allow users to customize the pseudos.
I would suggest passing the pseudo info into the install method in the setup_pseudos.py.

@unkcpz unkcpz force-pushed the fix/490/pre-download-pseudos branch 2 times, most recently from 110c0ae to 16b9606 Compare November 8, 2023 10:53
@unkcpz
Copy link
Member Author

unkcpz commented Nov 8, 2023

The issue is opened in #550 for future enhancement on the generic pseudo setup tool.

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

LTGM.

@unkcpz unkcpz merged commit 772f1fd into main Nov 8, 2023
11 of 12 checks passed
@unkcpz unkcpz deleted the fix/490/pre-download-pseudos branch November 8, 2023 21:58
@unkcpz
Copy link
Member Author

unkcpz commented Nov 8, 2023

@superstar54 thanks a lot for the review!

unkcpz added a commit that referenced this pull request Nov 8, 2023
fixes #490

In this commit, we pinging the aiida-pseudo version to use the
--download-only option to download the pseudo archive to the container
for quick installation when the container first time start.
Note that from the test all 8 pseudos seems to only save ~10s but in the place where the network condition is bad, this is very helpful.

Further more Refactoring the methods in setup_pseudos.py to support flexible parameter passing.
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.

Accelerate the docker image by pre-download the pseudos libraries
3 participants