Skip to content

Commit 89e1f1c

Browse files
muyangyuapplechanglan
authored andcommitted
Use a flag to control whether readiness prob is enabled
GitOrigin-RevId: 26af676
1 parent 1c51bd1 commit 89e1f1c

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

axlearn/cloud/gcp/pathways_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ class Config(BaseLeaderWorkerTemplate.Config):
883883

884884
target_port: Optional[int] = None
885885
enable_service: bool = None
886+
enable_health_probes: Optional[bool] = None
886887

887888
# Health probe configuration for inference pods.
888889
# - startup_probe_failure_threshold: Max consecutive failures before probe fails.
@@ -928,6 +929,12 @@ def define_flags(cls, fv):
928929
"Whether to enable creation of service for LWS",
929930
**common_kwargs,
930931
)
932+
flags.DEFINE_boolean(
933+
"enable_health_probes",
934+
False,
935+
"Whether to enable health probes for LWS service",
936+
**common_kwargs,
937+
)
931938
flags.DEFINE_integer(
932939
"target_port",
933940
None,
@@ -962,6 +969,7 @@ def set_defaults(cls, fv):
962969
fv.set_default("pathways_head_mem", fv.pathways_head_mem or "16")
963970
fv.set_default("target_port", fv.target_port or 9000)
964971
fv.set_default("enable_service", fv.enable_service or False)
972+
fv.set_default("enable_health_probes", fv.enable_health_probes or False)
965973

966974
@classmethod
967975
def default_config(cls):
@@ -1128,7 +1136,7 @@ def _build_head_container(self) -> dict:
11281136
# Add health probes for inference pods when service is enabled.
11291137
# This ensures K8s services only route traffic to healthy pods that have
11301138
# finished loading models and are ready to serve requests.
1131-
if cfg.enable_service:
1139+
if cfg.enable_health_probes:
11321140
# startupProbe: Allows long startup time for model loading.
11331141
# Max startup time = failureThreshold * periodSeconds.
11341142
container["startupProbe"] = {

axlearn/cloud/gcp/pathways_utils_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def test_health_probes_configuration(
614614
with (
615615
self._job_config(
616616
CloudBuildBundler,
617-
enable_service=True,
617+
enable_health_probes=True,
618618
health_check_path=health_check_path,
619619
health_check_port=health_check_port,
620620
startup_probe_failure_threshold=startup_probe_failure_threshold,
@@ -646,12 +646,12 @@ def test_health_probes_configuration(
646646
# readinessProbe failureThreshold is always 3
647647
self.assertEqual(readiness_probe["failureThreshold"], 3)
648648

649-
def test_no_health_probes_when_service_disabled(self):
650-
"""Tests that health probes are not added when enable_service is False."""
649+
def test_no_health_probes_when_readiness_probe_disabled(self):
650+
"""Tests that health probes are not added when enable_health_probes is False."""
651651
with (
652652
self._job_config(
653653
CloudBuildBundler,
654-
enable_service=False,
654+
enable_health_probes=False,
655655
) as (cfg, bundler_cfg),
656656
):
657657
cfg.inner.set(

0 commit comments

Comments
 (0)