We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af5acd6 commit b6b9450Copy full SHA for b6b9450
torchx/util/session.py
@@ -7,9 +7,12 @@
7
8
# pyre-strict
9
10
+import os
11
import uuid
12
from typing import Optional
13
14
+TORCHX_INTERNAL_SESSION_ID = "TORCHX_INTERNAL_SESSION_ID"
15
+
16
CURRENT_SESSION_ID: Optional[str] = None
17
18
@@ -22,6 +25,10 @@ def get_session_id_or_create_new() -> str:
22
25
global CURRENT_SESSION_ID
23
26
if CURRENT_SESSION_ID:
24
27
return CURRENT_SESSION_ID
28
+ env_session_id = os.getenv(TORCHX_INTERNAL_SESSION_ID)
29
+ if env_session_id:
30
+ CURRENT_SESSION_ID = env_session_id
31
+ return CURRENT_SESSION_ID
32
session_id = str(uuid.uuid4())
33
CURRENT_SESSION_ID = session_id
34
return session_id
0 commit comments