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

Iterate over each artifacts instead of capturing in a list #486

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

harshad16
Copy link
Member

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

  • Moved the function code get_package_artifacts directly into get_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.

  • The function get_package_data didn't seem to be used anywhere
    so it is now merged in get_package_hashes

@sesheta sesheta added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 1, 2022
Copy link
Contributor

@mayaCostantini mayaCostantini left a comment

Choose a reason for hiding this comment

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

lgtm, thanks! 💯

@sesheta
Copy link
Member

sesheta commented Dec 2, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sesheta sesheta added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 2, 2022
Copy link
Member

@KPostOffice KPostOffice left a 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)
Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

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

Copy link
Member Author

@harshad16 harshad16 Jan 13, 2023

Choose a reason for hiding this comment

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

ack, I have moved the symbol gathering also under the flag with_included_files.
To have consistency, it seems other functions too have digest and symbols under the same flag.

if with_included_files:

if with_included_files:

PTAL and Review again.
Thanks

@@ -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(
Copy link
Member

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?

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 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

Copy link
Member

Choose a reason for hiding this comment

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

Ahh got it

@sesheta
Copy link
Member

sesheta commented Jan 13, 2023

@harshad16: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
aicoe-ci/prow/pre-commit e2fb2ca link true /test pre-commit

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.

Copy link
Member

@KPostOffice KPostOffice left a comment

Choose a reason for hiding this comment

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

/lgtm

@sesheta sesheta added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2023
@harshad16
Copy link
Member Author

Merging it for release.

@harshad16 harshad16 merged commit f656e65 into thoth-station:master Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants