Skip to content

Commit f79eebd

Browse files
authored
[core] Using full string-literals for config variable names so you can find them in the code with search. (#58943)
Metric names and config variable names are one of the places with being verbose and duplicating prefixes is fine. You should be able to search through the code and find them easily. Signed-off-by: irabbani <[email protected]>
1 parent a1167ad commit f79eebd

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

python/ray/dashboard/modules/aggregator/aggregator_agent.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@
2828

2929
logger = logging.getLogger(__name__)
3030

31-
# Environment variables for the aggregator agent
32-
env_var_prefix = "RAY_DASHBOARD_AGGREGATOR_AGENT"
3331
# Max number of threads for the thread pool executor handling CPU intensive tasks
3432
THREAD_POOL_EXECUTOR_MAX_WORKERS = ray_constants.env_integer(
35-
f"{env_var_prefix}_THREAD_POOL_EXECUTOR_MAX_WORKERS", 1
33+
"RAY_DASHBOARD_AGGREGATOR_AGENT_THREAD_POOL_EXECUTOR_MAX_WORKERS", 1
3634
)
3735
# Interval to check the main thread liveness
3836
CHECK_MAIN_THREAD_LIVENESS_INTERVAL_SECONDS = ray_constants.env_float(
39-
f"{env_var_prefix}_CHECK_MAIN_THREAD_LIVENESS_INTERVAL_SECONDS", 0.1
37+
"RAY_DASHBOARD_AGGREGATOR_AGENT_CHECK_MAIN_THREAD_LIVENESS_INTERVAL_SECONDS", 0.1
4038
)
4139
# Maximum size of the event buffer in the aggregator agent
4240
MAX_EVENT_BUFFER_SIZE = ray_constants.env_integer(
43-
f"{env_var_prefix}_MAX_EVENT_BUFFER_SIZE", 1000000
41+
"RAY_DASHBOARD_AGGREGATOR_AGENT_MAX_EVENT_BUFFER_SIZE", 1000000
4442
)
4543
# Maximum number of events to send in a single batch to the destination
4644
MAX_EVENT_SEND_BATCH_SIZE = ray_constants.env_integer(
47-
f"{env_var_prefix}_MAX_EVENT_SEND_BATCH_SIZE", 10000
45+
"RAY_DASHBOARD_AGGREGATOR_AGENT_MAX_EVENT_SEND_BATCH_SIZE", 10000
4846
)
4947
# Address of the external service to send events with format of "http://<ip>:<port>"
50-
EVENTS_EXPORT_ADDR = os.environ.get(f"{env_var_prefix}_EVENTS_EXPORT_ADDR", "")
48+
EVENTS_EXPORT_ADDR = os.environ.get(
49+
"RAY_DASHBOARD_AGGREGATOR_AGENT_EVENTS_EXPORT_ADDR", ""
50+
)
5151
# Event filtering configurations
5252
# Comma-separated list of event types that are allowed to be exposed to external services
5353
# Valid values: TASK_DEFINITION_EVENT, TASK_EXECUTION_EVENT, ACTOR_TASK_DEFINITION_EVENT, ACTOR_TASK_EXECUTION_EVENT
@@ -60,17 +60,18 @@
6060
"NODE_DEFINITION_EVENT,NODE_LIFECYCLE_EVENT,"
6161
)
6262
EXPOSABLE_EVENT_TYPES = os.environ.get(
63-
f"{env_var_prefix}_EXPOSABLE_EVENT_TYPES", DEFAULT_EXPOSABLE_EVENT_TYPES
63+
"RAY_DASHBOARD_AGGREGATOR_AGENT_EXPOSABLE_EVENT_TYPES",
64+
DEFAULT_EXPOSABLE_EVENT_TYPES,
6465
)
6566
# flag to enable publishing events to the external HTTP service
6667
PUBLISH_EVENTS_TO_EXTERNAL_HTTP_SERVICE = ray_constants.env_bool(
67-
f"{env_var_prefix}_PUBLISH_EVENTS_TO_EXTERNAL_HTTP_SERVICE", True
68+
"RAY_DASHBOARD_AGGREGATOR_AGENT_PUBLISH_EVENTS_TO_EXTERNAL_HTTP_SERVICE", True
6869
)
6970
# flag to control whether preserve the proto field name when converting the events to
7071
# JSON. If True, the proto field name will be preserved. If False, the proto field name
7172
# will be converted to camel case.
7273
PRESERVE_PROTO_FIELD_NAME = ray_constants.env_bool(
73-
f"{env_var_prefix}_PRESERVE_PROTO_FIELD_NAME", False
74+
"RAY_DASHBOARD_AGGREGATOR_AGENT_PRESERVE_PROTO_FIELD_NAME", False
7475
)
7576

7677

0 commit comments

Comments
 (0)