Skip to content

Commit c3593a9

Browse files
committed
phase1: fix two bugs surfaced by the GPU smoke
1. Don't rmtree clip_root/frames when re-bridging: egoinfinity import stores real frames there (symlink at extract_frames/frames pointing back), so re-running phase1 on an imported clip was deleting the frames. Skip the bridge when it already resolves to extract_frames/frames. 2. Pass --only=<id> not --only <id> to batch_pipeline: clip ids can start with '-' (YouTube-derived), which argparse mistook for a flag.
1 parent d1e3787 commit c3593a9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

egoinfinity/stages/phase1.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ def run(self, ctx: StageContext) -> None:
5353
src_frames = ctx.artifacts.path("extract_frames", "frames")
5454
if not src_frames.exists():
5555
raise FileNotFoundError(f"frames missing at {src_frames}; run extract_frames first")
56-
if bridge_frames.exists() or bridge_frames.is_symlink():
57-
bridge_frames.unlink() if bridge_frames.is_symlink() else shutil.rmtree(bridge_frames)
58-
bridge_frames.symlink_to(src_frames.resolve())
56+
# Don't touch clip_root/frames if it already resolves to the same dir as
57+
# extract_frames/frames. `egoinfinity import` stores the REAL frames at
58+
# clip_root/frames with a symlink at extract_frames/frames pointing back,
59+
# so blindly rmtree-ing clip_root/frames here would delete the imported
60+
# frames. Only (re)create the bridge when it's missing or points elsewhere.
61+
already = bridge_frames.exists() and src_frames.resolve() == bridge_frames.resolve()
62+
if not already:
63+
if bridge_frames.exists() or bridge_frames.is_symlink():
64+
bridge_frames.unlink() if bridge_frames.is_symlink() else shutil.rmtree(bridge_frames)
65+
bridge_frames.symlink_to(src_frames.resolve())
5966

6067
# batch_pipeline relies on a favorites-style manifest with objects[].
6168
# The pipeline manifest already has video_uri + objects + start + end.
@@ -81,9 +88,11 @@ def run(self, ctx: StageContext) -> None:
8188
if not ctx.stage_config.args.get("run_track", True):
8289
env["EGOINFINITY_RUN_TRACK"] = "0"
8390

91+
# `--only=<id>` (not `--only <id>`): clip ids can start with '-'
92+
# (YouTube-derived), which argparse would otherwise treat as a flag.
8493
cmd = [sys.executable, "-m", "tools.batch_pipeline",
8594
"--favorites-dir", str(favorites_dir),
86-
"--only", clip_id, "--force"]
95+
f"--only={clip_id}", "--force"]
8796
if not ctx.stage_config.args.get("with_sam3d_worker", False):
8897
cmd.append("--no-sam3d-worker")
8998
sam3d_preset = ctx.stage_config.args.get("sam3d_preset")

0 commit comments

Comments
 (0)