Skip to content

[Test] Add @global_cache decorator for cross-process file-based caching, used to reduce the number of EC2 calls to fetch flexible instance types#7402

Open
gmarciani wants to merge 1 commit into
aws:developfrom
gmarciani:wip/mgiacomo/3160/test-flex-cache-0520-1
Open

[Test] Add @global_cache decorator for cross-process file-based caching, used to reduce the number of EC2 calls to fetch flexible instance types#7402
gmarciani wants to merge 1 commit into
aws:developfrom
gmarciani:wip/mgiacomo/3160/test-flex-cache-0520-1

Conversation

@gmarciani
Copy link
Copy Markdown
Contributor

@gmarciani gmarciani commented May 20, 2026

Description of changes

Add @global_cache decorator for cross-process file-based caching, used to reduce the number of EC2 calls to fetch flexible instance types.

Example of usage

The decorator will cache results by arguments. Whatever caller, in whatever process, that calls the function with the same arguments will retrieve the cached result. The results are cached into a random file in /tmp whose access is synchronized by file-locking.

from framework.file_cache import file_cache

@file_cache("my_results")
def my_function(arg1, arg2):
    ...

Tests

ONGOING 2 parallel executions of test_ebs_single will trigger just one request to retrieve the list of flexible instance types, while before this fix it used to trigger one.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@gmarciani gmarciani added skip-changelog-update Disables the check that enforces changelog updates in PRs 3.x Test labels May 20, 2026
@gmarciani gmarciani marked this pull request as ready for review May 21, 2026 07:09
@gmarciani gmarciani requested review from a team as code owners May 21, 2026 07:09
@gmarciani gmarciani force-pushed the wip/mgiacomo/3160/test-flex-cache-0520-1 branch 2 times, most recently from 529c845 to e18a361 Compare May 21, 2026 17:43
…d caching and used it to cache flexible instance types to reduce EC2 requests.
@gmarciani gmarciani force-pushed the wip/mgiacomo/3160/test-flex-cache-0520-1 branch from e18a361 to 893738f Compare May 22, 2026 14:11
@gmarciani gmarciani changed the title [Test] Add caching to flexible instance type retrieval to minimize the number of EC2 requests. [Test] Add @global_cache decorator for cross-process file-based caching, used to reduce the number of EC2 calls to fetch flexible instance types May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x skip-changelog-update Disables the check that enforces changelog updates in PRs Test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant