Skip to content

Commit 73e7cac

Browse files
committed
adding sidecar support
1 parent 2cb53bb commit 73e7cac

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

pathwaysutils/experimental/shared_pathways_service/isc_pathways.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,31 @@ class ProxyOptions:
4545
Attributes:
4646
use_insecure_credentials: Whether to use insecure gRPC credentials for the
4747
proxy server.
48+
sidecar_name: The name of the colocated Python sidecar to register with the
49+
proxy. When set (e.g. to "external"), the proxy passes
50+
``--sidecar_name=<value>`` so that ``jax.experimental.colocated_python``
51+
can reach the sidecar containers running on the worker pods. Leave as
52+
``None`` when no sidecar is deployed.
4853
"""
4954
use_insecure_credentials: bool = False
55+
sidecar_name: str | None = None
5056

5157
@classmethod
5258
def from_list(cls, options: Iterable[str] | None) -> "ProxyOptions":
5359
"""Creates a ProxyOptions object from a list of 'key:value' strings."""
5460
use_insecure = False
61+
sidecar_name = None
5562
for option in options or []:
5663
if ":" in option:
5764
key, value = option.split(":", 1)
5865
if key.strip().lower() == "use_insecure_credentials":
5966
use_insecure = value.strip().lower() == "true"
60-
return cls(use_insecure_credentials=use_insecure)
67+
elif key.strip().lower() == "sidecar_name":
68+
sidecar_name = value.strip()
69+
return cls(
70+
use_insecure_credentials=use_insecure,
71+
sidecar_name=sidecar_name,
72+
)
6173

6274

6375
def _deploy_pathways_proxy_server(
@@ -106,6 +118,12 @@ def _deploy_pathways_proxy_server(
106118
' value: "true"\n'
107119
)
108120

121+
sidecar_args_str = ""
122+
if proxy_options.sidecar_name:
123+
sidecar_args_str = (
124+
f"- --sidecar_name={proxy_options.sidecar_name}"
125+
)
126+
109127
template = string.Template(yaml_template)
110128
substituted_yaml = template.substitute(
111129
PROXY_JOB_NAME=proxy_job_name,
@@ -116,6 +134,7 @@ def _deploy_pathways_proxy_server(
116134
GCS_SCRATCH_LOCATION=gcs_scratch_location,
117135
PROXY_SERVER_IMAGE=proxy_server_image,
118136
PROXY_ENV=proxy_env_str,
137+
SIDECAR_ARGS=sidecar_args_str,
119138
)
120139

121140
_logger.info("Deploying Pathways proxy: %s", proxy_job_name)

pathwaysutils/experimental/shared_pathways_service/yamls/pw-proxy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:
2121
- --resource_manager_address=${PATHWAYS_HEAD_HOSTNAME}:${PATHWAYS_HEAD_PORT}
2222
- --gcs_scratch_location=${GCS_SCRATCH_LOCATION}
2323
- --virtual_slices=${EXPECTED_INSTANCES}
24+
${SIDECAR_ARGS}
2425
env:
2526
${PROXY_ENV}
2627
ports:

0 commit comments

Comments
 (0)