From 2df44658eff62fefc8b04592f485bed84ef986f9 Mon Sep 17 00:00:00 2001 From: Mark Kittisopikul Date: Tue, 7 Jul 2026 20:53:22 -0400 Subject: [PATCH] Use explicit --manifest-path for pixi jobs instead of unsetting PIXI_PROJECT_MANIFEST pixi's --manifest-path flag always overrides the PIXI_PROJECT_MANIFEST env var, so pointing pixi run at the manifest directory explicitly is more robust than unsetting the env var and relying on cwd-based discovery. Introduces FG_MANIFEST_DIR, exported alongside FG_WORK_DIR for all job types. Co-Authored-By: Claude Sonnet 5 --- fileglancer/apps/jobs.py | 8 ++++++-- fileglancer/apps/pixi.py | 2 +- tests/test_apps.py | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fileglancer/apps/jobs.py b/fileglancer/apps/jobs.py index 4d84a70f..62d16ca6 100644 --- a/fileglancer/apps/jobs.py +++ b/fileglancer/apps/jobs.py @@ -870,12 +870,16 @@ async def submit_job( # Set up the script preamble: # - FG_WORK_DIR: the job's working directory (used by subsequent variables) - # - Unset PIXI_PROJECT_MANIFEST so pixi uses the repo's own manifest + # - FG_MANIFEST_DIR: the directory containing the app's manifest (pixi.toml, + # runnables.yaml, etc.), so commands can reference it explicitly instead + # of relying on the cwd. Always points at the manifest directory, even + # when effective_working_dir is "work" (the repo stays reachable there + # via the `repo` symlink). # - SERVICE_URL_PATH: for service-type jobs, where to write the service URL # - cd into the repo so commands can find project files (pixi.toml, scripts, etc.) preamble_lines = [ - "unset PIXI_PROJECT_MANIFEST", f"export FG_WORK_DIR={shlex.quote(str(work_dir))}", + f'export FG_MANIFEST_DIR="$FG_WORK_DIR"/{shlex.quote(cd_suffix)}', # Where the script reports its startup phase (e.g. pulling a container # image). The UI reads this to explain a wait before a service is ready. 'export FG_PHASE_PATH="$FG_WORK_DIR/phase"', diff --git a/fileglancer/apps/pixi.py b/fileglancer/apps/pixi.py index 9c99c5d8..1687a204 100644 --- a/fileglancer/apps/pixi.py +++ b/fileglancer/apps/pixi.py @@ -139,7 +139,7 @@ def _task_to_entry_point(name: str, task: dict) -> AppEntryPoint | None: cmd = " ".join(cmd) # Build the pixi run command - command = f"pixi run {name}" + command = f'pixi run --manifest-path "$FG_MANIFEST_DIR" {name}' description = task.get("description") diff --git a/tests/test_apps.py b/tests/test_apps.py index 3d6c236b..cb0f868b 100644 --- a/tests/test_apps.py +++ b/tests/test_apps.py @@ -2857,8 +2857,10 @@ def test_script_layout_and_parameter_quoting(self, tmp_path, monkeypatch): ) script = self._submitted(calls)["command"] - assert script.startswith("unset PIXI_PROJECT_MANIFEST") - assert f"export FG_WORK_DIR={shlex.quote(job.work_dir)}" in script + assert script.startswith(f"export FG_WORK_DIR={shlex.quote(job.work_dir)}") + # FG_MANIFEST_DIR always points at the manifest's directory, so + # pixi-style commands can pass --manifest-path explicitly. + assert 'export FG_MANIFEST_DIR="$FG_WORK_DIR"/repo' in script # Default working dir is the repo snapshot (no manifest subdir here). assert 'cd "$FG_WORK_DIR"/repo' in script assert "conda activate tools" in script