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(weave): Elide display names that exceed the char limit #3046

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

andrewtruong
Copy link
Collaborator

@andrewtruong andrewtruong commented Nov 21, 2024

This PR elides all call display_name to be at most the max char limit.

Internal thread:
https://weightsandbiases.slack.com/archives/C01T8BLDHKP/p1732213159962419?thread_ts=1732208270.722299&cid=C01T8BLDHKP

@andrewtruong andrewtruong changed the base branch from master to andrew/bump-limits November 21, 2024 19:29
@@ -8,6 +8,33 @@
from threading import Thread as _Thread
from typing import Any, Callable

LOG_ONCE_MESSAGE_SUFFIX = " (subsequent messages of this type will be suppressed)"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This code is moved from op_extensions/log_once.py so it's more accessible

from weave.trace.refs import ObjectRef
from weave.trace.util import log_once
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see comment below

@@ -10,7 +10,7 @@

from weave.trace.context.tests_context import get_raise_on_captured_errors
from weave.trace.op import FinishCallbackType, Op
from weave.trace.op_extensions.log_once import log_once
from weave.trace.util import log_once
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see comment below

@@ -41,9 +42,9 @@
from weave.trace.serializer import get_serializer_for_obj
from weave.trace.settings import client_parallelism
from weave.trace.table import Table
from weave.trace.util import deprecated
from weave.trace.util import deprecated, log_once
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see comment below

@circle-job-mirror
Copy link

circle-job-mirror bot commented Nov 21, 2024

Comment on lines +205 to +214
@property
def display_name(self) -> str | Callable[[Call], str] | None:
return self._display_name

@display_name.setter
def display_name(self, name: str | Callable[[Call], str] | None) -> None:
if isinstance(name, str):
name = elide_display_name(name)
self._display_name = name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is kinda ugly, but it will ensure the display_name is always correct

@andrewtruong andrewtruong marked this pull request as ready for review November 21, 2024 19:45
@andrewtruong andrewtruong requested a review from a team as a code owner November 21, 2024 19:45
Base automatically changed from andrew/bump-limits to master November 21, 2024 20:00
@andrewtruong andrewtruong merged commit 97bd622 into master Nov 21, 2024
116 checks passed
@andrewtruong andrewtruong deleted the andrew/elide branch November 21, 2024 22:46
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants