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

fix: support **kwargs in taskgraph.util.memoize #490

Merged
merged 1 commit into from
Apr 20, 2024
Merged

Conversation

ahal
Copy link
Collaborator

@ahal ahal commented Apr 19, 2024

Previously this decorator only accepted *args, so any memoized function that used **kwargs could no longer be called via keyword arguments.

This is handled by replacing our custom memoize implementation with the built-in functools.lru_cache(maxsize=None) which is equivalent.

@ahal ahal self-assigned this Apr 19, 2024
@ahal ahal requested review from a team and hneiva April 19, 2024 14:35
@ahal ahal marked this pull request as draft April 19, 2024 14:57
Previously this decorator only accepted `*args`, so any memoized
function that used `**kwargs` could no longer be called via keyword
arguments.

This is handled by replacing our custom memoize implementation with the
built-in `functools.lru_cache(maxsize=None)` which is equivalent.
@ahal ahal marked this pull request as ready for review April 19, 2024 17:19
@@ -167,7 +167,8 @@ def add_resource_monitor(config, tasks):
config.graph_config, task["worker-type"]
)
# Normalise worker os so that linux-bitbar and similar use linux tools.
worker_os = worker_os.split("-")[0]
if worker_os:
worker_os = worker_os.split("-")[0]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not really sure why, but for some reason switching to lru_cache causes Pyright to (rightly) flag this issue.

@ahal ahal merged commit 29f5d60 into taskcluster:main Apr 20, 2024
9 checks passed
@ahal ahal deleted the memoize branch April 20, 2024 15:25
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.

2 participants