Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions torchx/util/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ def get_session_id_or_create_new() -> str:
"""
Returns the current session ID, or creates a new one if none exists.
The session ID remains the same as long as it is in the same process.
Please DO NOT use this function out of torchx codebase.
"""
global CURRENT_SESSION_ID
if CURRENT_SESSION_ID:
return CURRENT_SESSION_ID
session_id = str(uuid.uuid4())
CURRENT_SESSION_ID = session_id
return session_id


def get_torchx_session_id() -> Optional[str]:
"""
Returns the torchx session ID.
Please use this function to get the session ID out of torchx codebase.
"""
return CURRENT_SESSION_ID
Loading