Skip to content

Commit 6476748

Browse files
[bugfix]: make worker signal test CI-safe
1 parent b1867a1 commit 6476748

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

fastvideo/tests/worker/test_signal_terminated_worker_is_reported.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
import fastvideo.worker.multiproc_executor as multiproc_executor
2929
from fastvideo.worker.multiproc_executor import WorkerMultiprocProc
3030

31+
# The spawn context reimports PyTorch and FastVideo in every child. That takes
32+
# nearly five seconds even on the local GB10 and can take longer on a loaded ARM
33+
# CI node, so a five-second startup deadline makes the signal contract flaky.
34+
_SUBPROCESS_TIMEOUT_SECONDS = 30
35+
3136

3237
class _ReadyPipe:
3338

@@ -179,16 +184,17 @@ def test_worker_main_forwards_real_signal_traceback_across_processes(signum: int
179184
child_ready_pipe.close()
180185

181186
try:
182-
assert entered_signal_point.wait(timeout=5), "child did not reach the requested signal point"
187+
reached_signal_point = entered_signal_point.wait(timeout=_SUBPROCESS_TIMEOUT_SECONDS)
188+
assert reached_signal_point, "child did not reach the requested signal point"
183189
if signal_point == "worker_loop":
184190
assert parent_ready_pipe.recv() == {"status": "READY"}
185191

186192
os.kill(process.pid, signum)
187-
process.join(timeout=5)
193+
process.join(timeout=_SUBPROCESS_TIMEOUT_SECONDS)
188194
assert not process.is_alive(), "signalled worker did not exit"
189195
assert process.exitcode == 0 # Preserve the historical argument-less SystemExit status.
190196

191-
record = log_queue.get(timeout=5)
197+
record = log_queue.get(timeout=_SUBPROCESS_TIMEOUT_SECONDS)
192198
message = record.getMessage()
193199
assert f"Worker 7 received {signal.Signals(signum).name} ({signum})" in message
194200
assert "Traceback (most recent call last)" in message
@@ -203,7 +209,7 @@ def test_worker_main_forwards_real_signal_traceback_across_processes(signum: int
203209
finally:
204210
if process.is_alive():
205211
process.kill()
206-
process.join(timeout=5)
212+
process.join(timeout=_SUBPROCESS_TIMEOUT_SECONDS)
207213
parent_ready_pipe.close()
208214
log_queue.close()
209215
log_queue.join_thread()

0 commit comments

Comments
 (0)