Skip to content

Commit f5d25f0

Browse files
authored
expose torchx session ID to torchx downstream users.
Differential Revision: D63655049 Pull Request resolved: #959
1 parent 94ac896 commit f5d25f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

torchx/util/session.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,19 @@ def get_session_id_or_create_new() -> str:
1717
"""
1818
Returns the current session ID, or creates a new one if none exists.
1919
The session ID remains the same as long as it is in the same process.
20+
Please DO NOT use this function out of torchx codebase.
2021
"""
2122
global CURRENT_SESSION_ID
2223
if CURRENT_SESSION_ID:
2324
return CURRENT_SESSION_ID
2425
session_id = str(uuid.uuid4())
2526
CURRENT_SESSION_ID = session_id
2627
return session_id
28+
29+
30+
def get_torchx_session_id() -> Optional[str]:
31+
"""
32+
Returns the torchx session ID.
33+
Please use this function to get the session ID out of torchx codebase.
34+
"""
35+
return CURRENT_SESSION_ID

0 commit comments

Comments
 (0)