Skip to content

Commit e4800c7

Browse files
yikaiMetafacebook-github-bot
authored andcommitted
Add torchx session id as Environment variable
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. Differential Revision: D66387522
1 parent 5ad30fe commit e4800c7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

torchx/runner/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
from torchx.tracker.api import (
3737
ENV_TORCHX_JOB_ID,
3838
ENV_TORCHX_PARENT_RUN_ID,
39+
ENV_TORCHX_SESSION_ID,
3940
ENV_TORCHX_TRACKERS,
4041
tracker_config_env_var_name,
4142
)
43+
from torchx.util.session import get_session_id_or_create_new
4244

4345
from torchx.util.types import none_throws
4446
from torchx.workspace.api import PkgInfo, WorkspaceBuilder, WorkspaceMixin
@@ -390,6 +392,7 @@ def dryrun(
390392
role.env[ENV_TORCHX_JOB_ID] = make_app_handle(
391393
scheduler, self._name, macros.app_id
392394
)
395+
role.env[ENV_TORCHX_SESSION_ID] = get_session_id_or_create_new()
393396

394397
if parent_run_id:
395398
role.env[ENV_TORCHX_PARENT_RUN_ID] = parent_run_id

torchx/tracker/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ENV_TORCHX_TRACKERS = "TORCHX_TRACKERS"
2424
ENV_TORCHX_PARENT_RUN_ID = "TORCHX_PARENT_RUN_ID"
2525
ENV_TORCHX_JOB_ID = "TORCHX_JOB_ID"
26+
ENV_TORCHX_SESSION_ID = "TORCHX_SESSION_ID"
2627

2728

2829
@dataclass

0 commit comments

Comments
 (0)