Skip to content

Commit

Permalink
raise exceptions if encountered in threaded concurrency test (#26263)
Browse files Browse the repository at this point in the history
## Summary & Motivation
Need more traces in debugging spurious sqlite threaded tests.

## How I Tested These Changes
BK
  • Loading branch information
prha authored Dec 4, 2024
1 parent b395187 commit 0c137c5
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5118,20 +5118,16 @@ def _occupy_slot(key: str):
time.sleep(0.05)
storage.free_concurrency_slot_for_step(run_id, key)

start = time.time()
with ThreadPoolExecutor() as executor:
futures = [executor.submit(_occupy_slot, str(i)) for i in range(100)]
while not all(f.done() for f in futures) and time.time() < start + TOTAL_TIMEOUT_TIME:
time.sleep(0.1)

list(
executor.map(_occupy_slot, [str(i) for i in range(100)], timeout=TOTAL_TIMEOUT_TIME)
)
foo_info = storage.get_concurrency_info("foo")
assert foo_info.slot_count == 5
assert foo_info.active_slot_count == 0
assert foo_info.pending_step_count == 0
assert foo_info.assigned_step_count == 0

assert all(f.done() for f in futures)

def test_zero_concurrency(self, storage: EventLogStorage):
assert storage
if not storage.supports_global_concurrency_limits:
Expand Down

0 comments on commit 0c137c5

Please sign in to comment.