Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests - check clean WFQ; wave spacing #124

Merged
merged 3 commits into from
Sep 30, 2024
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
6 changes: 4 additions & 2 deletions tests/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def workflow_two() -> None:
assert handle2.get_result() == None
assert flag
assert wf_counter == 1
assert queue_entries_are_cleaned_up(dbos)


def test_queue_childwf(dbos: DBOS) -> None:
Expand Down Expand Up @@ -226,11 +227,12 @@ def test_workflow(var1: str, var2: str) -> float:
# Verify that each "wave" of tasks started at the ~same time.
for wave in range(num_waves):
for i in range(wave * limit, (wave + 1) * limit - 1):
assert times[i + 1] - times[i] < 0.1
assert times[i + 1] - times[i] < 0.2

# Verify that the gap between "waves" is ~equal to the period
for wave in range(num_waves - 1):
assert times[limit * wave] - times[limit * wave - 1] < period + 0.1
assert times[limit * (wave + 1)] - times[limit * wave] > period - 0.2
assert times[limit * (wave + 1)] - times[limit * wave] < period + 0.2

# Verify all workflows get the SUCCESS status eventually
dbos._sys_db.wait_for_buffer_flush()
Expand Down