-
Notifications
You must be signed in to change notification settings - Fork 73
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
Conversation
@@ -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)" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=966ea5d7c322c9aa0fd3744bfdb43f93e287473a |
@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 | ||
|
There was a problem hiding this comment.
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
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