From 4cc21b00b1587a2410ae5ae2f378aad7c7808b2f Mon Sep 17 00:00:00 2001 From: Yikai Gao Date: Tue, 26 Nov 2024 15:01:49 -0800 Subject: [PATCH] Add torchx session id as Environment variable (#974) Summary: This diff passes the torchx_session_id as an environment variable. In penv_python, I will fetch this id and log it into logging table. With the session id, it is possible to join the logging table of penv_python with the logging table of torchx. Reviewed By: tonykao8080 Differential Revision: D66387522 --- torchx/runner/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/torchx/runner/api.py b/torchx/runner/api.py index 39efc0555..4a03a8aad 100644 --- a/torchx/runner/api.py +++ b/torchx/runner/api.py @@ -39,6 +39,7 @@ ENV_TORCHX_TRACKERS, tracker_config_env_var_name, ) +from torchx.util.session import get_session_id_or_create_new, TORCHX_INTERNAL_SESSION_ID from torchx.util.types import none_throws from torchx.workspace.api import PkgInfo, WorkspaceBuilder, WorkspaceMixin @@ -390,6 +391,7 @@ def dryrun( role.env[ENV_TORCHX_JOB_ID] = make_app_handle( scheduler, self._name, macros.app_id ) + role.env[TORCHX_INTERNAL_SESSION_ID] = get_session_id_or_create_new() if parent_run_id: role.env[ENV_TORCHX_PARENT_RUN_ID] = parent_run_id