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

Introducing version_naming property that makes modulefile as version … #679

Merged
merged 12 commits into from
Jan 11, 2025

Conversation

Amjadhpc
Copy link
Contributor

@Amjadhpc Amjadhpc commented Jan 1, 2025

This is an attempt to fix issue number 26 raised by me.
I have not tested all settings

shpc/main/modules/base.py Outdated Show resolved Hide resolved
shpc/main/modules/base.py Outdated Show resolved Hide resolved
@vsoch
Copy link
Member

vsoch commented Jan 2, 2025

Looks like there are issues with the updated runner - let me see what I can do in another PR.

@vsoch
Copy link
Member

vsoch commented Jan 2, 2025

@Amjadhpc could you please add a test that enables the new setting and ensures it produces the right output? And @muffato I'm interested in your feedback here since you are correct views could be an alternative solution.

@vsoch
Copy link
Member

vsoch commented Jan 5, 2025

I think you probably want to try:

client.settings.set("version_naming", True)
assert client.settings.get("version_naming") == True

@@ -69,7 +69,7 @@ def test_disabled_version_naming_install(
client = init_client(str(tmp_path), module_sys, container_tech)

client.settings.set("version_naming", False)
assert client.settings.set("version_naming", False) is False
assert client.settings.set("version_naming") == False
Copy link
Member

Choose a reason for hiding this comment

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

You need to first set it, and then use get to check the setting is what you set it to.

@vsoch
Copy link
Member

vsoch commented Jan 8, 2025

Nicely done! You'll want to (as a final step) bump the version in shpc/version.py and add a note to the CHANGELOG.md. @marcodelapierre and @muffato do you have any comments for the review?

@@ -470,7 +473,14 @@ def install(

# Get the template based on the module and container type
template = self.template.load(self.templatefile)
module_path = os.path.join(module.module_dir, self.modulefile)
if self.settings.version_naming:
self._modulefile = name.split(":")[1]
Copy link
Member

Choose a reason for hiding this comment

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

What is self._modulefile used for? I only see it in this small set of statements. It might make sense to just use name.split(":")[1] in the one place it is needed and not save a private class variable.

@marcodelapierre
Copy link
Contributor

Hi, it is always great to see contributions coming from users!

As per @muffato 's comment in #678 ,
I would like to know whether module views do not fit your usage scenario and in which aspects.
In fact, the idea of views was to have a solid default structure for the default module tree, and then offer ways to customise the module tree in a user defined view. As @muffato mentions in the original issue, customising the naming of modules is one of the views' features.

I think it would be good to know whether Views can work in your user case or not, to try and not duplicate functionalities if not needed. Either way, discussing these aspects with users of the software has a great deal of added value, in making sure the software is useful to the community, both in terms of functionality and documentation on how to use them.

My 2 cents :)

@vsoch
Copy link
Member

vsoch commented Jan 8, 2025

I agree it's not good to duplicate functionality, but in that views adds complexity (and this change makes it possible to generate the default with versions) I'm wondering if this isn't a good addition regardless.

@@ -68,6 +68,9 @@ singularity_shell: /bin/sh
podman_shell: /bin/sh
docker_shell: /bin/sh

#Experimental version naming tag so that modulefile is changed to version number . Default value is false. Issue number 26
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest having this right after default_version option, line 39, as they are related

@marcodelapierre
Copy link
Contributor

Good point @vsoch :)

I will not have the chance to test this PR.

One comment I have is: is the PR been designed and tested while taking into account the implementation and options of the default_version setting? I bet there may be some specific requirements/adjustments coming out of it.

@Amjadhpc
Copy link
Contributor Author

Amjadhpc commented Jan 9, 2025

Nicely done! You'll want to (as a final step) bump the version in shpc/version.py and add a note to the CHANGELOG.md. @marcodelapierre and @muffato do you have any comments for the review?

The version in shpc/version.py is
version = "0.1.29"

You want me to bump it to "0.1.30"?
But there is no Release for 0.1.29, the last release was 0.1.28?

@@ -470,7 +473,13 @@ def install(

# Get the template based on the module and container type
template = self.template.load(self.templatefile)
module_path = os.path.join(module.module_dir, self.modulefile)
if self.settings.version_naming:
module._module_dir = os.path.dirname(module.module_dir)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please walk me through why we need a private class variable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, forgot to clean it up, its not needed and have been fixed in new commit

@vsoch
Copy link
Member

vsoch commented Jan 11, 2025

@Amjadhpc you'll need to go up to 0.1.31 now - we had another PR merge in this morning.

@Amjadhpc
Copy link
Contributor Author

Looks like it has reached docker pull rate limit

WARNING: Couldn't use cached digest for registry: GET https://index.docker.io/v2/library/python/manifests/sha256:7dd8962ad2a63403428d652a64d814a5002f1386379355edf5970e40557fe4e6: TOOMANYREQUESTS: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
WARNING: Falling back to direct digest.
FATAL: docker://python@sha256:7dd8962ad2a63403428d652a64d814a5002f1386379355edf5970e40557fe4e6: GET https://index.docker.io/v2/library/python/manifests/sha256:7dd8962ad2a63403428d652a64d814a5002f1386379355edf5970e40557fe4e6: TOOMANYREQUESTS: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

@vsoch
Copy link
Member

vsoch commented Jan 11, 2025

@Amjadhpc it's an ephemeral error, OK to run again. I'm not going to put credentials in there just for these rare cases.

Copy link
Member

@vsoch vsoch left a comment

Choose a reason for hiding this comment

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

Nice work @Amjadhpc !

@vsoch vsoch merged commit 7af1150 into singularityhub:main Jan 11, 2025
10 checks passed
@Amjadhpc
Copy link
Contributor Author

Thanks for your help and guidance @vsoch

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