[bugfix] Fix test env defaults and server dependencies (#1901)

The distributed_setup test fixture now sets MASTER_ADDR and MASTER_PORT when
they are not set, with a new port for each test, and restores them after the
test. pyproject.toml now declares orjson and python-multipart, which the
OpenAI-compatible server needs. Two documents about the SSIM reference
bootstrap are corrected.
This commit is contained in:
Wenbo Ji 嵇文博
2026-10-07 15:32:22 -07:00
committed by GitHub
parent ef63de1f60
commit 4ebf11f7d9
4 changed files with 25 additions and 10 deletions
+5 -4
View File
@@ -233,10 +233,11 @@ test fails. For new-model PRs, CI can run SSIM in bootstrap mode so missing
references are uploaded as draft artifacts for review instead of immediately
blocking on a missing canonical reference.
Buildkite enables SSIM bootstrap mode when either condition is true:
- the PR title or Buildkite message contains `[new-model]`;
- `FASTVIDEO_SSIM_BOOTSTRAP_MODE=1` is set for the Buildkite job.
The active Slurm SSIM lane (`.buildkite/scripts/lanes/ssim.sh`) enables
bootstrap mode only when `FASTVIDEO_SSIM_BOOTSTRAP_MODE=1` is set for the
Buildkite job. A `[new-model]` PR title does not enable it on this path (only
the retired Modal script `.buildkite/scripts/pr_test.sh` checked the title), so
ask a maintainer to start the SSIM job with that variable set.
Bootstrap mode passes `--ssim-bootstrap-mode` to pytest. When a generated
artifact is available, the test uploads it under the `drafts/...` namespace in
+15 -4
View File
@@ -1,12 +1,15 @@
# SPDX-License-Identifier: Apache-2.0
import contextlib
import os
import pytest
import torch
import numpy as np
from fastvideo import envs
from fastvideo.distributed import (maybe_init_distributed_environment_and_model_parallel, cleanup_dist_env_and_memory)
from fastvideo.utils import get_open_port
@pytest.fixture(scope="function")
@@ -18,10 +21,18 @@ def distributed_setup():
"""
torch.manual_seed(42)
np.random.seed(42)
maybe_init_distributed_environment_and_model_parallel(1, 1)
yield
cleanup_dist_env_and_memory()
with contextlib.ExitStack() as stack:
# The env:// rendezvous needs these outside the CI runner. Keep values the
# launcher provides; otherwise use a fresh port per test and restore on exit.
if os.environ.get("MASTER_ADDR") is None:
stack.enter_context(envs.override_external("MASTER_ADDR", "127.0.0.1"))
if os.environ.get("MASTER_PORT") is None:
stack.enter_context(envs.override_external("MASTER_PORT", str(get_open_port())))
maybe_init_distributed_environment_and_model_parallel(1, 1)
try:
yield
finally:
cleanup_dist_env_and_memory()
@pytest.fixture
+3 -2
View File
@@ -89,8 +89,9 @@ into one subprocess per model id by setting `FASTVIDEO_SSIM_MODEL_ID`.
## Bootstrapping New References
Normal SSIM runs are strict: missing references fail the test. For a new model
PR, add `[new-model]` to the PR title or set `FASTVIDEO_SSIM_BOOTSTRAP_MODE=1`
for the Buildkite job. CI then passes `--ssim-bootstrap-mode` to pytest.
PR, a maintainer sets `FASTVIDEO_SSIM_BOOTSTRAP_MODE=1` for the Buildkite SSIM
job (the Slurm lane does not read the PR title). CI then passes
`--ssim-bootstrap-mode` to pytest.
In bootstrap mode, a missing pixel `.mp4` or latent `.pt` reference is treated
as an expected draft-reference case after the generated artifact has been
+2
View File
@@ -105,6 +105,8 @@ dependencies = [
# Job Runner
"fastapi>=0.129.0",
"orjson>=3.9.0", # fastapi ORJSONResponse in the OpenAI-compatible server
"python-multipart>=0.0.18", # fastapi Form/UploadFile parsing
"uvicorn>=0.41.0"
]