fix(runner): remap remote-worker output paths after collect

Pre-existing working-tree fix committed for the record: result.json from
a remote worker carries paths on ITS disk; remap by the out/-relative
tail (basename fallback) and log skipped outputs instead of silently
dropping them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
m3ultra 2026-07-22 19:04:23 +10:00
parent b1d37b1629
commit a095f1a140

View File

@ -341,11 +341,25 @@ class Runner:
p = Path(out["path"])
if not p.is_absolute():
p = outdir / p
if not p.exists():
# a remote worker writes result.json with paths on ITS disk
# (<root>/data/remote/<job>/out/...); after collect() those
# files sit in the local outdir — remap by the out/-relative
# tail, falling back to the basename
marker = f"/data/remote/{job_id}/out/"
_, _, tail = str(out["path"]).partition(marker)
if tail and (outdir / tail).exists():
p = outdir / tail
else:
p = outdir / Path(out["path"]).name
if p.exists():
a = store.register_file(con, p, name=out.get("name"),
parent_job=job_id, move=True, meta=out.get("meta"),
user_id=owner_id)
registered.append(a["id"])
else:
print(f"[runner] {job_id}: result.json output not found after "
f"collect, skipped: {out.get('path')}", flush=True)
else:
for p in sorted(outdir.iterdir()):
if p.name == "result.json" or p.name.startswith("."):