Skip to content

Commit 7d76d5f

Browse files
committed
fix trace replay tests for multiprocessing context
Signed-off-by: Vincent Gimenes <vincent.gimenes@gmail.com>
1 parent c0739e4 commit 7d76d5f

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

tests/unit/scheduler/test_trace_replay.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import asyncio
1414
import json
1515
import math
16+
from multiprocessing import get_context
1617
from pathlib import Path
1718

1819
import pytest
@@ -171,7 +172,11 @@ def test_next_request_time_scaled_timestamps(self):
171172
relative_timestamps=[0.0, 0.5, 1.0],
172173
time_scale=2.0,
173174
)
174-
strategy.init_processes_timings(worker_count=1, max_concurrency=10)
175+
strategy.init_processes_timings(
176+
worker_count=1,
177+
max_concurrency=10,
178+
mp_context=get_context(),
179+
)
175180
strategy.init_processes_start(1000.0)
176181
expected = [1000.0, 1001.0, 1002.0]
177182

@@ -194,7 +199,11 @@ def test_next_request_time_beyond_trace_parks_worker(self):
194199
relative_timestamps=[0.0, 1.0],
195200
time_scale=1.0,
196201
)
197-
strategy.init_processes_timings(worker_count=1, max_concurrency=10)
202+
strategy.init_processes_timings(
203+
worker_count=1,
204+
max_concurrency=10,
205+
mp_context=get_context(),
206+
)
198207
strategy.init_processes_start(500.0)
199208

200209
async def run():
@@ -239,7 +248,11 @@ def test_scheduling_patterns(self, timestamps, expected):
239248
relative_timestamps=timestamps,
240249
time_scale=1.0,
241250
)
242-
strategy.init_processes_timings(worker_count=3, max_concurrency=10)
251+
strategy.init_processes_timings(
252+
worker_count=3,
253+
max_concurrency=10,
254+
mp_context=get_context(),
255+
)
243256
strategy.init_processes_start(1000.0)
244257

245258
async def run():

0 commit comments

Comments
 (0)