Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions python/ray/dashboard/optional_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import aiohttp.web # noqa: F401
import aiohttp_cors # noqa: F401
import grpc # noqa: F401
import tzlocal # noqa: F401

# These checks have to come first because aiohttp looks
# for opencensus, too, and raises a different error otherwise.
Expand Down
45 changes: 2 additions & 43 deletions python/ray/dashboard/timezone_utils.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
import logging
from datetime import datetime

logger = logging.getLogger(__name__)

timezones = [
{"offset": "-12:00", "value": "Etc/+12"},
{"offset": "-11:00", "value": "Pacific/Pago_Pago"},
{"offset": "-10:00", "value": "Pacific/Honolulu"},
{"offset": "-09:00", "value": "America/Anchorage"},
{"offset": "-08:00", "value": "America/Los_Angeles"},
{"offset": "-07:00", "value": "America/Phoenix"},
{"offset": "-06:00", "value": "America/Guatemala"},
{"offset": "-05:00", "value": "America/Bogota"},
{"offset": "-04:00", "value": "America/Halifax"},
{"offset": "-03:30", "value": "America/St_Johns"},
{"offset": "-03:00", "value": "America/Sao_Paulo"},
{"offset": "-02:00", "value": "America/Godthab"},
{"offset": "-01:00", "value": "Atlantic/Azores"},
{"offset": "+00:00", "value": "Europe/London"},
{"offset": "+01:00", "value": "Europe/Amsterdam"},
{"offset": "+02:00", "value": "Asia/Amman"},
{"offset": "+03:00", "value": "Asia/Baghdad"},
{"offset": "+03:30", "value": "Asia/Tehran"},
{"offset": "+04:00", "value": "Asia/Dubai"},
{"offset": "+04:30", "value": "Asia/Kabul"},
{"offset": "+05:00", "value": "Asia/Karachi"},
{"offset": "+05:30", "value": "Asia/Kolkata"},
{"offset": "+05:45", "value": "Asia/Kathmandu"},
{"offset": "+06:00", "value": "Asia/Almaty"},
{"offset": "+06:30", "value": "Asia/Yangon"},
{"offset": "+07:00", "value": "Asia/Bangkok"},
{"offset": "+08:00", "value": "Asia/Shanghai"},
{"offset": "+09:00", "value": "Asia/Irkutsk"},
{"offset": "+09:30", "value": "Australia/Adelaide"},
{"offset": "+10:00", "value": "Australia/Brisbane"},
{"offset": "+11:00", "value": "Asia/Magadan"},
{"offset": "+12:00", "value": "Pacific/Auckland"},
{"offset": "+13:00", "value": "Pacific/Tongatapu"},
]
import tzlocal


def get_current_timezone_info():
Expand All @@ -48,9 +10,6 @@ def get_current_timezone_info():
sign = "+" if hours >= 0 else "-"
current_offset = f"{sign}{abs(int(hours)):02d}:{abs(int(minutes)):02d}"

current_timezone = next(
(tz for tz in timezones if tz["offset"] == current_offset),
{"offset": None, "value": None},
)
current_timezone = {"offset": current_offset, "value": tzlocal.get_localzone_name()}
Copy link
Collaborator

@aslonnie aslonnie Mar 14, 2025

Choose a reason for hiding this comment

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

why this get_current_timezone_info is required in the first place? for frontend ui, it should either use browser time or use utc, right? why does server side local timezone even matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not implement this feature of yours. I'm trying to fix that the feature doesn't work. If you would rather drop the server timezone and just use the browser's time zone, that's fine by me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, I am more of asking the component owner.

Copy link
Contributor

Choose a reason for hiding this comment

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

The default option is to use server timestamp because that is the timestamp that is printed to the log files.

We provide an option to use the browser timestamp for convenience, but that will not update the timestamp already printed to logs, which will be confusing.

The Ray Dashboard does not parse any logs today. It just prints them as raw text.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the simplest approach would be if we used UTC everywhere, but I'm not sure if that's the behavior everyone wants.

A quick fix to the issue at hand would be to drop the timezone names from the UI and only show offset numbers in the dropdown.


return current_timezone