Skip to content

Commit cc0b62e

Browse files
yikaiMetafacebook-github-bot
authored andcommitted
Add torchx session id as Environment variable (meta-pytorch#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. Differential Revision: D66387522
1 parent 53933e3 commit cc0b62e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

torchx/runner/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
ENV_TORCHX_TRACKERS,
4040
tracker_config_env_var_name,
4141
)
42+
from torchx.util.session import get_session_id_or_create_new, TORCHX_INTERNAL_SESSION_ID
4243

4344
from torchx.util.types import none_throws
4445
from torchx.workspace.api import PkgInfo, WorkspaceBuilder, WorkspaceMixin
@@ -390,6 +391,7 @@ def dryrun(
390391
role.env[ENV_TORCHX_JOB_ID] = make_app_handle(
391392
scheduler, self._name, macros.app_id
392393
)
394+
role.env[TORCHX_INTERNAL_SESSION_ID] = get_session_id_or_create_new()
393395

394396
if parent_run_id:
395397
role.env[ENV_TORCHX_PARENT_RUN_ID] = parent_run_id

0 commit comments

Comments
 (0)