Skip to content

Conversation

@fruch
Copy link
Contributor

@fruch fruch commented May 27, 2025

so we won't hit s3 urls on each start of a test (cause of multiple calls to scylla_repository.setup())

we gonna cache this call for the time of the test session

on a new test session, those would be called only once

@fruch fruch requested review from a team and mykaul May 27, 2025 12:24
@mykaul mykaul requested a review from Copilot May 27, 2025 13:58
Copy link
Contributor

@mykaul mykaul left a comment

Choose a reason for hiding this comment

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

Thanks, didn't know '@cache' is the same as '@lru_cache'

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces caching for repository setup functions to prevent repeated S3 downloads during a single test session.

  • Added @cache decorator to setup in both scylla_repository.py and repository.py
  • Imported functools.cache to enable caching
  • Ensures each setup call with the same parameters runs only once per test session

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ccmlib/scylla_repository.py Imported cache and applied @cache to setup and setup_scylla_manager
ccmlib/repository.py Imported cache and applied @cache to setup
Comments suppressed due to low confidence (3)

ccmlib/scylla_repository.py:226

  • Add or update tests to verify that calling setup multiple times with identical parameters does not trigger additional downloads, ensuring the caching layer works correctly.
@cache

ccmlib/scylla_repository.py:13

  • Ensure that functools.cache is supported in the project's minimum Python version; if not, consider using functools.lru_cache(maxsize=None) for backward compatibility.
from functools import cache

ccmlib/repository.py:16

  • Verify that functools.cache is available for all supported Python versions; if backward compatibility is needed, prefer functools.lru_cache(maxsize=None).
from functools import cache

@fruch
Copy link
Contributor Author

fruch commented May 27, 2025

Thanks, didn't know '@cache' is the same as '@lru_cache'

It's been so only since python 3.9

And the CI test is still also for 3.8 :(

@dkropachev
Copy link
Contributor

Thanks, didn't know '@cache' is the same as '@lru_cache'

It's been so only since python 3.9

And the CI test is still also for 3.8 :(

If you change it to @lru_cache it should work on older python

@fruch
Copy link
Contributor Author

fruch commented May 27, 2025

Thanks, didn't know '@cache' is the same as '@lru_cache'

It's been so only since python 3.9
And the CI test is still also for 3.8 :(

If you change it to @lru_cache it should work on older python

I know that, we still need to drop 3.8 support it's EOL

@fruch fruch force-pushed the cache_setups branch 2 times, most recently from f9f2abc to 15d7f1a Compare May 27, 2025 19:11
fruch added 2 commits May 27, 2025 22:40
so we won't hit s3 urls on each start of a test (cause of multiple
calls to `scylla_repository.setup()`)

we gonna cache this call for the time of the test session

on a new test session, those would be called only once
@fruch fruch merged commit f520ffc into scylladb:master May 27, 2025
4 checks passed
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.

3 participants