Add GPU selection to job launcher
This commit is contained in:
@@ -28,6 +28,7 @@ def evaluate_project() -> dict:
|
||||
"""Return product/implementation suggestions for the current web platform."""
|
||||
frontend = settings.project_root / "frontend" / "src" / "main.tsx"
|
||||
backend = settings.project_root / "backend" / "app" / "main.py"
|
||||
jobs_backend = settings.project_root / "backend" / "app" / "jobs.py"
|
||||
readme = settings.project_root / "README.md"
|
||||
catalog = get_catalog()
|
||||
coverage = get_coverage_report()
|
||||
@@ -36,6 +37,7 @@ def evaluate_project() -> dict:
|
||||
|
||||
frontend_text = frontend.read_text(encoding="utf-8") if frontend.exists() else ""
|
||||
backend_text = backend.read_text(encoding="utf-8") if backend.exists() else ""
|
||||
jobs_text = jobs_backend.read_text(encoding="utf-8") if jobs_backend.exists() else ""
|
||||
acceptance_text = (settings.project_root / "backend" / "app" / "acceptance.py").read_text(encoding="utf-8")
|
||||
readme_text = readme.read_text(encoding="utf-8") if readme.exists() else ""
|
||||
|
||||
@@ -59,6 +61,13 @@ def evaluate_project() -> dict:
|
||||
and "setResults(resultsNext)" in frontend_text
|
||||
and "slice(0, 240)" not in frontend_text,
|
||||
"job_progress_ui": "JobProgressBar" in frontend_text and "progressTrack" in frontend_text,
|
||||
"gpu_task_selection_ui": "selectedGpuIds" in frontend_text
|
||||
and "gpuSelector" in frontend_text
|
||||
and "jobPayload" in frontend_text
|
||||
and "selectedGpuDevice" in frontend_text
|
||||
and "gpu_count" in frontend_text
|
||||
and "gpus" in frontend_text
|
||||
and "CUDA_VISIBLE_DEVICES" in jobs_text,
|
||||
"live_log_stream_ui": "EventSource" in frontend_text
|
||||
and "eventSourceRef" in frontend_text
|
||||
and "log_size" in frontend_text
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app import jobs
|
||||
from app.commands import CommandSpec
|
||||
from app.jobs import default_conda_env_for_job
|
||||
from app.main import _job_with_progress, app
|
||||
from app.schemas import JobCreate
|
||||
|
||||
|
||||
def test_mmseg_jobs_use_mmseg_conda_env_by_default():
|
||||
@@ -9,6 +12,16 @@ def test_mmseg_jobs_use_mmseg_conda_env_by_default():
|
||||
assert default_conda_env_for_job("segmodel.train") == "seg_smp"
|
||||
|
||||
|
||||
def test_build_task_sets_cuda_visible_devices(tmp_path, monkeypatch):
|
||||
def fake_build_module_task(job_type, params, conda_env):
|
||||
return CommandSpec(["python", "-c", "print('ok')"], tmp_path, "fake task")
|
||||
|
||||
monkeypatch.setattr(jobs, "build_module_task", fake_build_module_task)
|
||||
spec = jobs._build_task(JobCreate(type="mock.echo", params={}, gpus=[2, 0]))
|
||||
|
||||
assert spec.env["CUDA_VISIBLE_DEVICES"] == "2,0"
|
||||
|
||||
|
||||
def test_job_progress_reports_log_size(tmp_path):
|
||||
log_path = tmp_path / "job.log"
|
||||
log_path.write_text("line one\nline two\n", encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user