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

Define daemon restart command based on the aiida-core version #424

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Apr 28, 2024

Fix #423 .

After installing or updating a plugin package, one needs to restart the daemon with the --reset flag for changes to take effect.

Besides, in the latest aiida-core branch, this is now the default. aiidateam/aiida-core#6317, thus we need to define the restart command based on aiida-core version

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 59.95%. Comparing base (7f2d0ba) to head (6c10edc).

❗ Current head 6c10edc differs from pull request most recent head 7d4cf28. Consider uploading reports for the commit 7d4cf28 to get more accurate results

Files Patch % Lines
aiidalab/utils.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
- Coverage   60.09%   59.95%   -0.14%     
==========================================
  Files          23       23              
  Lines        1466     1471       +5     
==========================================
+ Hits          881      882       +1     
- Misses        585      589       +4     
Flag Coverage Δ
py-3.10 59.95% <20.00%> (-0.14%) ⬇️
py-3.11 59.95% <20.00%> (-0.14%) ⬇️
py-3.8 59.95% <20.00%> (-0.14%) ⬇️
py-3.9 59.95% <20.00%> (-0.14%) ⬇️

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

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

@superstar54
Copy link
Member Author

Hi @danielhollas, This is a critical bug. In the QEApp case, this blocks running the latest QEApp in image-2.4.3. When this PR gets merged, could you make a new release of aiidalab? Thanks!

Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

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

Thanks for the change.

Not sure I understand how this affects QeApp. Are you calling this function from QeApp? If that's the case, I would advise to simply copy it to reduce coupling between this package and QeApp.

# however, in the latest aiida-core branch, this is now the default.
# Define command based on aiida-core version
aiida_version = version("aiida-core")
if aiida_version <= "2.5.1":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this distinction? I believe the --reset flag is still present in upcoming version no? Or am I wrong?

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 about this. This at least covers all our docker images and the latest stable AiiDA. We may update it when the new AiiDA version is available. I can open an issue for reminder.

Do you have any better suggestions to handle it?

@superstar54
Copy link
Member Author

superstar54 commented Apr 29, 2024

Hi @danielhollas , thanks for your review.

Are you calling this function from QeApp?

No. I install QEApp from AiiDAlab App Store. And aiidalab will call this function. Here is the detailed step to reproduce:

  • use aiidalab-launch to create a profile using the latest image, the aiida-core version is 2.4.3
  • install QEApp (version 2024.04.0a3 or later) from App Store
  • run a simple job (bands)
  • The job is excepted. In the report of the failed process, it show that the daemon can not load the module (Changes to take effect after updating a plugin package in AiiDA daemon #423 )
  • Open a terminal and run verdi daemon restart; it will not solve this problem. This is how aiidalab does when installing/updating a new app.
  • Run verdi daemon restart --reset, will solve it.

This is a problem not only for QEApp, --reset is always recommended when installing a new app.

@superstar54
Copy link
Member Author

superstar54 commented Apr 29, 2024

Hi @danielhollas , I added verdi daemon restart --reset in the post_install script to manually restart daemon after installing QEApp. It allows the latest QEApp to run in image-2.4.3 now. So there is no hurry to release the new aiidalab version.

Though, I believe it's still good to fix this issue.

Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

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

Thanks @superstar54. I am just really surprised that we did not run into this earlier.
Good call on integrating this to QeApp for now, because we don't need to rush releasiing this package (and we would need to release new image with it as well!).

return subprocess.Popen(
["verdi", "daemon", "restart"],
command,
Copy link
Contributor

Choose a reason for hiding this comment

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

I just double checked that on current aiida-core main the --reset flag still exist (albeit is deprecated) so let's keep this simple

Suggested change
command,
["verdi", "daemon", "restart", "--reset"],

We can remove it once we switch to v2.6. Note in general we don't need to worry about supporting multiple aiida-core versions, since this package is baked into the image and cannot be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK to me! I removed the version check and simply added the --reset tag.

@danielhollas danielhollas merged commit bfca750 into aiidalab:main Apr 29, 2024
7 checks passed
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.

Changes to take effect after updating a plugin package in AiiDA daemon
2 participants