-
Notifications
You must be signed in to change notification settings - Fork 9
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
👌 IMPROVE: links to materials cloud SSSP archive #104
👌 IMPROVE: links to materials cloud SSSP archive #104
Conversation
91ce0b3
to
a0dc52c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mbercx . Have some suggestions and questions
aiida_pseudo/groups/family/sssp.py
Outdated
@@ -50,15 +53,17 @@ def format_configuration_label(cls, configuration: SsspConfiguration) -> str: | |||
) | |||
|
|||
@classmethod | |||
def format_configuration_filename(cls, configuration: SsspConfiguration, extension: str) -> str: | |||
def format_configuration_filename(cls, configuration: SsspConfiguration, extension: str, patch_version: Optional[str] = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it is a good idea to keep the patch version as a separate argument. Shouldn't we try to integrate this in the SsspConfiguration
. It already contains a version
attribute. If that is 1.2.3
than the patch version is 3
by definition. So to have a separate argument that can cause inconsistencies seems weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I did this is because I figured we'd stick to only having the minor versions as valid_configurations
. Else we still have to update the code in case a new patch version is released. So really all we need is to make sure the filename is updated to the correct patch version, not the actual SsspConfiguration
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, @sphuber! I made some first corrections, but have a look at this comment and see if you agree with my reasoning here before I continue.
I can remember the discussion about not fixing the patch number explicitly as that would require updates of the plugin if a new patch is released of the family, but I am having difficulty seeing how best to integrate this limitation. Can you share the content of the YAML mapping? Than I can form a better idea of what to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! It's a very simple mapping of the minor version to the latest patch version:
---
# This maps each minor version to the latest patch version
# corresponding to that minor version
'1.0': '1.0'
'1.1': '1.1.2'
Thanks for the review, @sphuber! I made some first corrections, but have a look at this comment and see if you agree with my reasoning here before I continue. |
(aiida-pseudo) mbercx@theospc46:~/envs/aiida-pseudo/code/aiida-pseudo$ git commit -a
Fix double quoted strings................................................Passed
Fix End of Files.........................................................Passed
Fix python encoding pragma...............................................Passed
Mixed line ending........................................................Passed
Trim Trailing Whitespace.................................................Passed
flynt....................................................................Passed
yapf.....................................................................Passed
pylint...................................................................Passed
pydocstyle...............................................................Passed
[fix/13/materialscloud-links 8874770] Apply more corrections from prime ape instance
2 files changed, 4 insertions(+), 6 deletions(-) |
url_sssp_base = 'https://legacy-archive.materialscloud.org/file/2018.0001/v4/' | ||
url_archive = f"{url_sssp_base}/{SsspFamily.format_configuration_filename(configuration, 'tar.gz')}" | ||
url_metadata = f"{url_sssp_base}/{SsspFamily.format_configuration_filename(configuration, 'json')}" | ||
url_template = 'https://archive.materialscloud.org/record/file?filename={filename}&parent_id=19' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. Everything looks good to me now, except I still have a question about this magic parent_id=19
. I have been trying to figure out how it relates to the main archive entry. I take it it refers to the actual archive record: https://archive.materialscloud.org/record/2021.76
As you can see, there in the URL it uses an ID that seems based on the year and some auto-incrementing number. But this ID changes if a new version of the SSSP record is created. The question is whether the parent_id=19
is persistent and doesn't change. I.e., when a v8
will be released with the next patch version of 1.1
, i.e. 1.1.3
, will the URL still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question indeed! I think it doesn't change, but let's ask @vgranata to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parent_id is persistent within versions of the same record, meaning that it does not change if a new version of a record is created.
If you create a new SSSP record that is not a new version of https://archive.materialscloud.org/record/2021.76 then the parent_id will be different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK Thanks @vgranata that should be fine. Then we can almost merge this @mbercx . Only thing is that we should probably add the patch version to the description of the group. Otherwise it will only be possible to know what patch version a certain family is by looking at the md5 of the tarball that was downloaded, which is contained in the description. I think it would make sense to store the patch at the very least in the description of the family. And then the tests should be fixed of course, because they are failing
Fixed the CI issues in #105 |
The current links used to download the SSSP pseudopotentials still point to the legacy materials cloud archive, which are hosted on a server that they want to shut down. Next to this, the archive now also contains new patch versions for minor version 1.1, with 1.1.2 being the latest. Since these patch versions usually implement bug fixes, there is no reason to install an outdated patch version. So instead of allowing the user to install specific patch versions, we'll simply stick to only using minor versions and make sure that the latest patch version is installed. Here we update the links to the new servers. However, we also add some extra functionality to retrieve a mapping of the latest patch version corresponding to the minor version of the configuration. Based on this mapping, the correct url is constructed for the archive and metadata.
Co-authored-by: Sebastiaan Huber <[email protected]>
The release `psycopg2-binary==2.9` breaks the unit test manager of `aiida-core`. This was fixed for in v1.6, however, that version no longer supports Python 3.6, which falls back on `aiida-core==1.5.2` and that doesn't apply the upper limit on `psycopg2-binary`, so we are forced to do it here. This limit can be removed once we drop support for Python 3.6. Also fixes two minor things brought up by `pylint`.
83eb4c3
to
665206d
Compare
@sphuber I've removed the |
@@ -104,13 +105,30 @@ def download_sssp( | |||
:param filepath_archive: absolute filepath to write the pseudopotential archive to. | |||
:param filepath_metadata: absolute filepath to write the metadata file to. | |||
:param traceback: boolean, if true, print the traceback when an exception occurs. | |||
:return: Latest patch version of the requested minor version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now just need to update the return type of this function as well and than this is good to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Righto! Missed that one, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More a sign that we should probably at some point at mypy
to the pre-commit. On the one hand I like added typing, but on the other hand mypy
has been given so much trouble that sometimes it annoys me to no end. :\rock: me :hardplace:
Thanks @mbercx |
Fixes #13
The current links used to download the SSSP pseudopotentials still point
to the legacy materials cloud archive, which are hosted on a server that
they want to shut down. Next to this, the archive now also contains new
patch versions for minor version 1.1, with 1.1.2 being the latest. Since
these patch versions usually implement bug fixes, there is no reason to
install an outdated patch version. So instead of allowing the user to
install specific patch versions, we'll simply stick to only using minor
versions and make sure that the latest patch version is installed.
Here we update the links to the new servers. However, we also add some
extra functionality to retrieve a mapping of the latest patch version
corresponding to the minor version of the configuration. Based on this
mapping, the correct url is constructed for the archive and metadata.