Skip to content

Commit 1303d45

Browse files
committed
Use Telemetry Configurations
1 parent 7b513bb commit 1303d45

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/swiss_ai_model_launch/assets/template.jinja

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ USE_OCF={{ "false" if disable_ocf else "true" }}
2323
OCF_SERVICE_NAME="llm"
2424
OCF_SERVICE_PORT=8080
2525

26-
curl -sf -X POST "https://sml-dev.swissai.svc.cscs.ch/launches" \
26+
{% if telemetry_endpoint %}
27+
curl -sf -X POST "{{ telemetry_endpoint }}" \
2728
-H "Content-Type: application/json" \
2829
-d '{"user": "aryan", "job_id": "'"${SLURM_JOB_ID}"'", "slurm_nodes": {{ nodes }}, "slurm_job_name": "{{ job_name }}", "slurm_partition": "{{ partition }}", "slurm_time": "{{ time }}", "slurm_account": "{{ account }}", "slurm_environment": "{{ environment }}", "interactive": false, "serving_framework": "{{ framework }}", "framework_args": "{{ framework_args }}", "pre_launch_cmds": "{{ pre_launch_cmds }}", "model_name": "string", "model_path": "string", "tp_size": 0, "host": "string", "port": 0, "workers": {{ workers }}, "nodes_per_worker": {{ nodes_per_worker }}, "worker_port": {{ worker_port }}, "use_router": {{ "true" if use_router else "false" }}, "router_environment": "{{ environment }}", "router_port": 30000, "router_args": "{{ router_args }}", "ocf_enabled": {{ "false" if disable_ocf else "true" }}, "ocf_bootstrap_addr": "string", "ocf_service_name": "llm", "ocf_service_port": 8080, "extra": {"additionalProp1": {}}, "raw_command": "string"}' || true
30+
{% endif %}
2931

3032
{% raw %}
3133
OCF_BOOTSTRAP_ADDR=$(curl -sf http://148.187.108.172:8092/v1/dnt/bootstraps \

src/swiss_ai_model_launch/cli/main.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _get_firecrest_client_from_init_config(config: InitConfig) -> f7t.v2.AsyncFi
3838

3939
async def _get_firecrest_launcher_with_client(
4040
client: f7t.v2.AsyncFirecrest,
41+
telemetry_endpoint: str | None = None,
4142
) -> FirecRESTLauncher:
4243
async def _get_systems() -> dict[str, tuple[str, str]]:
4344
return {
@@ -82,6 +83,7 @@ async def _get_partitions(
8283
username=user_info["user"]["name"],
8384
account=user_info["group"]["name"],
8485
partition=launcher_config.get_non_none_value("firecrest_partition"),
86+
telemetry_endpoint=telemetry_endpoint,
8587
)
8688

8789

@@ -225,7 +227,15 @@ async def _main() -> None:
225227
launcher_type = config.get_non_none_value("launcher")
226228
if launcher_type == "firecrest":
227229
firecrest_client = _get_firecrest_client_from_init_config(config)
228-
launcher = await _get_firecrest_launcher_with_client(firecrest_client)
230+
telemetry_endpoint = (
231+
config.get_value("telemetry_endpoint")
232+
if config.get_non_none_value("telemetry") == "default"
233+
else None
234+
)
235+
launcher = await _get_firecrest_launcher_with_client(
236+
firecrest_client,
237+
telemetry_endpoint=telemetry_endpoint,
238+
)
229239
else:
230240
raise NotImplementedError(f"Launcher {launcher_type} is not supported yet.")
231241

src/swiss_ai_model_launch/launchers/firecrest_launcher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ def __init__(
3636
username: str,
3737
account: str,
3838
partition: str,
39+
telemetry_endpoint: str | None = None,
3940
):
4041
super().__init__()
4142
self.client = client
4243
self.system_name = system_name
4344
self.username = username
4445
self.account = account
4546
self.partition = partition
47+
self.telemetry_endpoint = telemetry_endpoint
4648

4749
def _get_user_dir(self) -> str:
4850
return f"/users/{self.username}"
@@ -77,6 +79,7 @@ def _get_launch_args_from_request(
7779
"--host 0.0.0.0 "
7880
"--port 8080 "
7981
),
82+
telemetry_endpoint=self.telemetry_endpoint,
8083
)
8184

8285
def _get_local_env_file_path(self, launch_request: LaunchRequest) -> str:

src/swiss_ai_model_launch/launchers/launch_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class LaunchArgs(BaseModel):
2121
use_router: bool = False
2222
router_args: str = ""
2323
disable_ocf: bool = False
24+
telemetry_endpoint: str | None = None
2425

2526
@model_validator(mode="after")
2627
def set_defaults(self) -> "LaunchArgs":

0 commit comments

Comments
 (0)