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

[core] fix worker launch time formatting #43516

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions python/ray/util/state/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Humanify:
convert units into a human readable string."""

def timestamp(x: float):
"""Converts miliseconds to a datetime object."""
"""Converts milliseconds to a datetime object."""
return str(datetime.datetime.fromtimestamp(x / 1000))

def memory(x: int):
Expand All @@ -104,7 +104,7 @@ def memory(x: int):
return str(format(x, ".3f")) + " B"

def duration(x: int):
"""Converts miliseconds to a human readable duration."""
"""Converts milliseconds to a human readable duration."""
return str(datetime.timedelta(milliseconds=x))

def events(events: List[dict]):
Expand Down Expand Up @@ -630,12 +630,16 @@ class WorkerState(StateSchema):
#: -> start_time_ms (worker is ready to be used).
#: -> end_time_ms (worker is destroyed).
worker_launch_time_ms: Optional[int] = state_column(
filterable=False, detail=True, format_fn=Humanify.timestamp
filterable=False,
detail=True,
format_fn=lambda x: "" if x == -1 else Humanify.timestamp(x),
)
#: The time worker is succesfully launched
#: -1 if the value doesn't exist.
worker_launched_time_ms: Optional[int] = state_column(
filterable=False, detail=True, format_fn=Humanify.timestamp
filterable=False,
detail=True,
format_fn=lambda x: "" if x == -1 else Humanify.timestamp(x),
)
#: The time when the worker is started and initialized.
#: 0 if the value doesn't exist.
Expand Down