Add conda environment selector

This commit is contained in:
2026-06-30 16:01:41 +08:00
parent 73d15e9dce
commit e482651545
5 changed files with 79 additions and 4 deletions

View File

@@ -68,6 +68,11 @@ def evaluate_project() -> dict:
and "gpu_count" in frontend_text
and "gpus" in frontend_text
and "CUDA_VISIBLE_DEVICES" in jobs_text,
"conda_env_selection_ui": "/api/system/envs" in frontend_text
and "selectedCondaEnv" in frontend_text
and "runtimeSelector" in frontend_text
and "conda_env" in frontend_text
and "request.conda_env" in jobs_text,
"live_log_stream_ui": "EventSource" in frontend_text
and "eventSourceRef" in frontend_text
and "log_size" in frontend_text

View File

@@ -22,6 +22,19 @@ def test_build_task_sets_cuda_visible_devices(tmp_path, monkeypatch):
assert spec.env["CUDA_VISIBLE_DEVICES"] == "2,0"
def test_build_task_uses_requested_conda_env(tmp_path, monkeypatch):
captured = {}
def fake_build_module_task(job_type, params, conda_env):
captured["conda_env"] = conda_env
return CommandSpec(["python", "-c", "print('ok')"], tmp_path, "fake task")
monkeypatch.setattr(jobs, "build_module_task", fake_build_module_task)
jobs._build_task(JobCreate(type="segmodel.train", params={}, conda_env="seg_custom"))
assert captured["conda_env"] == "seg_custom"
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")