Skip to content

chore: KV router Pythonic cleanups #324

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

Merged
merged 6 commits into from
Mar 20, 2025
Merged

Conversation

PeaBrane
Copy link
Contributor

@PeaBrane PeaBrane commented Mar 20, 2025

Overview:

  1. Use getattr instead of hasattr to check the existence of the key (worker metrics). Cleaner and avoids a double lookup. Potentially avoids a race condition in multithreaded settings.
  2. Remove an unnecessary if statement for checking worker_logits, as a guard clause is already checking it.
  3. Added a docstring for the _cost_function method

Copy link

copy-pr-bot bot commented Mar 20, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@PeaBrane PeaBrane changed the title chore: use getattr consistent with the style of the other get methods chore: KV router Pythonic cleanups Mar 20, 2025
@PeaBrane PeaBrane merged commit c448061 into main Mar 20, 2025
5 checks passed
@PeaBrane PeaBrane deleted the rupei/kv-hasattr-cleanups branch March 20, 2025 23:23
kylehh pushed a commit to kylehh/dynamo that referenced this pull request Apr 11, 2025
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