8000 Strict dependencies check for aiida-core by unkcpz · Pull Request #128 · aiidalab/aiidalab-home · GitHub
[go: up one dir, main page]

Skip to content

Strict dependencies check for aiida-core - #128

Closed
unkcpz wants to merge 4 commits into
mainfrom
fea/xx/install-compatible-check
Closed

unkcpz wants to merge 4 commits into
mainfrom
fea/xx/install-compatible-check

Conversation

@unkcpz
@unkcpz unkcpz commented Feb 7, 2023
Copy link
Copy Markdown
Member

fixes aiidalab/aiidalab#318

The compatibilities only checked for the installed app. If the user going to install the app that would potentially override the aiida-core version the installation will fail in AppManager but the user is not notified before they trigger the installation procedure.
In this PR, the check for the to-be-installed app is activated when the version is selected and will block the user to install the app that has incompatible "core" dependencies. The "core" dependencies now are only aiida-core.
The method _check_strict_dependency is used to check that the aiida-core version of the container is not overridden by the app.

If the "core" dependencies are not incompatible, the dependencies to be installed or updated will show in the info notes to remind the user what will be overridden.

@unkcpz
unkcpz force-pushed the fea/xx/install-compatible-check branch from 32aeb0a to 2348ce4 Compare February 7, 2023 14:48
@unkcpz
unkcpz marked this pull request as draft February 7, 2023 15:02
@unkcpz
unkcpz marked this pull request as ready for review February 7, 2023 15:09
@unkcpz
unkcpz force-pushed the fea/xx/install-compatible-check branch from 2348ce4 to 1e04b32 Compare February 7, 2023 15:10
@unkcpz
unkcpz force-pushed the fea/xx/install-compatible-check branch from 88bcb12 to 8c29c10 Compare February 7, 2023 15:13
@unkcpz
unkcpz commented Feb 7, 2023
Copy link
Copy Markdown
Member Author

To test with this PR, you can clone the repo and ln the /home/jovyan/app/home to the new folder.

@danielhollas danielhollas left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @unkcpz, this is great, thanks for working on this. I did not test yet, for now just a couple of clarifying questions and some suggestions for variable names.

  1. Does this mean that no changes are needed in the aiidalab repo?
  2. Will this also allow us to solve the spurious "Update available", if the new version is incompatible? Perhaps that's for a follow up PR?
  3. We will need to backport this to the old docker stack image. We need to find out if the current aiidalab-home is still compatible or if there were any breaking changes in the meantime.

Comment thread home/app_manager.py Outdated
app_version, python_bin
)
packages = find_installed_packages(python_bin)
for requriment in unmatched_requirements:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo, needs to be fixed below as well

Suggested change
for requriment in unmatched_requirements:
for requirement in unmatched_requirements:

Comment thread home/app_manager.py Outdated
if app_version is None:
return []

dependencies = []
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clearer naming?

Suggested change
dependencies = []
dependencies_to_install = []

Comment thread home/app_manager.py
Note: Only check aiida-core compatibility at the moment
"""
for dep in dependencies:
if "aiida-core" in dep.installed:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please generalize this code for the future, define a list of strict dependencies as a global constant (probably at the top of the file or somwhere).

I also wonder, should this function be here or rather in aiidalab repo? I don't have an answer now, but something to think about.

Comment thread home/app_manager.py Outdated
cannot_reach_registry = (
self.app.remote_update_status is AppStatus.CANNOT_REACH_REGISTRY
)
strict_dependency = self._check_strict_dependencies(dependencies)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
strict_dependency = self._check_strict_dependencies(dependencies)
strict_dependency_violation = self._check_strict_dependencies(dependencies)

or maybe

Suggested change
strict_dependency = self._check_strict_dependencies(dependencies)
violates_strict_dependency = self._check_strict_dependencies(dependencies)

Comment thread home/app_manager.py Outdated
installed = self.app.is_installed()
installed_version = self.app.installed_version
version_to_install = self.version_selector.version_to_install
dependencies = self.find_to_be_installed_dependencies(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
dependencies = self.find_to_be_installed_dependencies(
dependencies_to_install = self.find_to_be_installed_dependencies(

Comment thread home/app_manager.py Outdated
if not busy and can_switch:
self.dependencies_install_info.value = (
self.DEPENDENCIES_INSTALL_INFO.render(
dependencies=dependencies,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
dependencies=dependencies,
dependencies=dependencies_to_install,

Comment thread home/app_manager.py Outdated
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
Following dependencie(s) will be changed:
<ul>
{% for p in dependencies %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comm 8000 ent to others. Learn more.

Suggested change
{% for p in dependencies %}
{% for p in dependencies_to_install %}

@unkcpz
unkcpz commented Feb 8, 2023
Copy link
Copy Markdown
Member Author

Thanks @danielhollas, you ask very valuable questions.

Does this mean that no changes are needed in the aiidalab repo?

When I started, I plan to put functions in aiidalab and only use aiidalab-home as the viewer to reflect the change but found it is hard to implement since there is back and forth traitslet change between two packages. I put all function in aiidalab-home to make me easy to code. After I look the changes again, I think the controller part need to move to aiidalab package, and it is now doable. I'll try to refactor it a bit to make it more clear.

Will this also allow us to solve the spurious "Update available", if the new version is incompatible? Perhaps that's for a follow up PR?

No, I didn't take it into account. I test on the latest docker stack to show that downgrade to old version is forbidden. But as you said, this change is more for forbidding user to upgrade app and override aiida-core. I'll check it again.

We will need to backport this to the old docker stack image. We need to find out if the current aiidalab-home is still compatible or if there were any breaking changes in the meantime.

I don't think there will be breaking changes but as mentioned above this need to backport and I'll test it.

@unkcpz
unkcpz force-pushed the fea/xx/install-compatible-check branch from 556f0fb to 1cc6ac1 Compare February 8, 2023 08:13
@unkcpz
unkcpz commented Feb 8, 2023
Copy link
Copy Markdown
Member Author

I address the variables naming suggested by @danielhollas and close this one with replaced it by #130.

@unkcpz unkcpz closed this Feb 8, 2023
@danielhollas
danielhollas deleted the fea/xx/install-compatible-check branch October 14, 2024 18: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.

modify the is_compatible() function too look at the constraints instead of the current environment

2 participants

0