Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions workers/proxy_worker/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing import Any, Optional

import grpc
from packaging.version import Version

from proxy_worker import protos
from proxy_worker.logging import (
Expand Down Expand Up @@ -102,8 +101,7 @@ def get_global_current_invocation_id() -> Optional[str]:
def get_current_invocation_id() -> Optional[Any]:
global _library_worker
# Check global current invocation first (most up-to-date)
if (_library_worker
and Version(_library_worker.version.VERSION) < Version("1.1.0b4")):
if _library_worker and not hasattr(_library_worker, 'invocation_id_cv'):
global_invocation_id = get_global_current_invocation_id()
if global_invocation_id is not None:
return global_invocation_id
Expand Down
6 changes: 6 additions & 0 deletions workers/tests/unittest_proxy/test_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ def setUp(self):
with dispatcher_module._current_invocation_lock:
dispatcher_module._current_invocation_id = None

# Clear library worker to ensure tests run with expected state
dispatcher_module._library_worker = None

def tearDown(self):
"""Clean up after each test"""
# Import the module-level variables properly
Expand All @@ -425,6 +428,9 @@ def tearDown(self):
with dispatcher_module._current_invocation_lock:
dispatcher_module._current_invocation_id = None

# Clear library worker
dispatcher_module._library_worker = None

def test_global_invocation_id_set_and_get(self):
"""Test setting and getting global current invocation ID"""
test_id = "test-invocation-123"
Expand Down
Loading