feat(postprocess): copy job metadata JSON to log directory for S3 upload#236
feat(postprocess): copy job metadata JSON to log directory for S3 upload#236KaunilD wants to merge 1 commit into
Conversation
Include {job_id}.json alongside config.yaml and sbatch_script.sh when
copying artifacts into the log directory, so job metadata is preserved
in S3 uploads.
Made-with: Cursor
📝 WalkthroughWalkthroughThe pull request extends the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/srtctl/cli/mixins/postprocess_stage.py (1)
299-300:⚠️ Potential issue | 🟠 MajorFix
container_mountstype mismatch to unblock CI.Line 299 and Line 441 pass
strmount mappings, butstart_srun_processexpectsdict[Path, Path] | None. This is currently failing type checks in CI.💡 Suggested fix
- container_mounts={str(self.runtime.log_dir): "/logs"}, + container_mounts={self.runtime.log_dir: Path("/logs")}, ... - container_mounts={str(self.runtime.log_dir): "/logs"}, + container_mounts={self.runtime.log_dir: Path("/logs")},Also applies to: 441-442
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/srtctl/cli/mixins/postprocess_stage.py` around lines 299 - 300, The container_mounts argument is being passed as str mappings but start_srun_process requires dict[Path, Path] | None; update the calls that set container_mounts (e.g., where container_mounts={str(self.runtime.log_dir): "/logs"}) to construct a dict[Path, Path] by converting both source and target to Path objects (e.g., Path(self.runtime.log_dir) -> Path("/logs") or Path("logs") as appropriate), ensure pathlib.Path is imported if not already, and apply the same change to the other occurrence that sets container_mounts so the types match start_srun_process's signature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/srtctl/cli/mixins/postprocess_stage.py`:
- Around line 299-300: The container_mounts argument is being passed as str
mappings but start_srun_process requires dict[Path, Path] | None; update the
calls that set container_mounts (e.g., where
container_mounts={str(self.runtime.log_dir): "/logs"}) to construct a dict[Path,
Path] by converting both source and target to Path objects (e.g.,
Path(self.runtime.log_dir) -> Path("/logs") or Path("logs") as appropriate),
ensure pathlib.Path is imported if not already, and apply the same change to the
other occurrence that sets container_mounts so the types match
start_srun_process's signature.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 73af19d0-9698-4061-9c0e-15375dcbad23
📒 Files selected for processing (2)
src/srtctl/cli/mixins/postprocess_stage.pytests/test_postprocess.py
| gets uploaded alongside benchmark results and worker logs. | ||
| At submit time, config.yaml, sbatch_script.sh, and {job_id}.json are saved | ||
| to outputs/{job_id}/, but S3 syncs outputs/{job_id}/logs/. This copies them | ||
| into logs/ so they get uploaded alongside benchmark results and worker logs. |
There was a problem hiding this comment.
Do you have to copy the files into /logs? Can you not also upload the files in the parent dir?
There was a problem hiding this comment.
i think the original intention is to be selective about rolling up the logs and avoiding the bloat. this helps us marshal it. for example there can be a .venv or it can have dataset jsons that are irrelevant experiment tracking.
There was a problem hiding this comment.
thanks for taking a look :)
Include {job_id}.json alongside config.yaml and sbatch_script.sh when copying artifacts into the log directory, so job metadata is preserved in S3 uploads.
Summary by CodeRabbit
New Features
Tests