-
Notifications
You must be signed in to change notification settings - Fork 12
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
Iterate over each artifacts instead of capturing in a list #486
Conversation
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.
lgtm, thanks! 💯
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mayaCostantini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Just a couple of comments, otherwise I think this is a really good optimization.
def get_package_hashes( | ||
self, package_name: str, package_version: str, with_included_files: bool = False, with_symbols: bool = False | ||
) -> list: | ||
"""Get information about release hashes available in this source index.""" | ||
if self.warehouse: | ||
return self._warehouse_get_package_hashes(package_name, package_version, with_included_files) |
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.
with_symbols
is lost here
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.
it's not used by _warehouse_get_package_hashes
right? did i miss something?
the only difference I noticed between get_package_data
func and get_package_hashes
func was the part
doc["symbols"] = artifact.get_versioned_symbols()
thats the reason to include the param with_symbols
please correct me if i missed it somewhere
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.
Just took a look at the code. My worry was that the symbols were never added to the document if the flag was set. It seems the opposite is actually true. _warehouse_get_package_hashes
always adds the symbols not matter what. I think we should add a conditional statement in _warehouse_get_package_hashes
so the return format is consistent. Let me know what you think
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.
thoth/python/source.py
Outdated
@@ -414,38 +388,42 @@ def provides_package_version(self, package_name: str, package_version: str) -> b | |||
return False | |||
|
|||
@lru_cache(maxsize=10) | |||
def get_package_data(self, package_name: str, package_version: str, with_included_files: bool = False) -> list: | |||
"""Get information about release hashes and symbols available in this source index.""" | |||
def get_package_hashes( |
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.
Why the change of the function name/doc line?
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.
I checked for the function get_package_data
across whole github, it didn't seem be used anywhere.
so merged it in function get_package_hashes
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.
Ahh got it
7f2b331
to
e2357e0
Compare
Signed-off-by: Harshad Reddy Nalla <[email protected]>
e2357e0
to
e2fb2ca
Compare
@harshad16: The following test failed, say
Full PR test history. Your PR dashboard. Please help us and open an issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
/lgtm
Merging it for release. |
Iterate over each artifacts instead of capturing in a list
Signed-off-by: Harshad Reddy Nalla [email protected]
Related Issues and Dependencies
Related-to: thoth-station/thoth-application#2690 (comment)
Description
get_package_artifacts
directly intoget_package_hashes
As each artifact object, is linked to the downloaded artifacts, they get deleted on obj deletion.
With this , each artifact would be live for short period till the hash is gathered.
Each artifact would be iterated one after another, instead of gathering them all in one list.
get_package_data
didn't seem to be used anywhereso it is now merged in
get_package_hashes