Skip to content

Support copying back MLC cached entry for mlc remote-run and mlc slurm-run - #311

Merged
anandhu-eng merged 9 commits into
mainfrom
copilot/support-copying-back-mlc-cached-entry
Aug 17, 2026
Merged

Support copying back MLC cached entry for mlc remote-run and mlc slurm-run#311
anandhu-eng merged 9 commits into
mainfrom
copilot/support-copying-back-mlc-cached-entry

Conversation

Copilot AI commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Adds options to copy the MLC cache directory back to the local machine after mlc remote-run and mlc slurm-run complete.

remote_run.py

  • --remote_copy_back_mlc_cache — appends the remote MLC cache dir to files_to_copy_back, which the remote,run,cmds,ssh script rsync's back. Handles both normal mode (~/MLC/repos/local/cache) and --remote_isolated (absolute temp-dir path, known at command construction time).
  • --remote_copy_back_mlc_cache_path — overrides the local destination; takes precedence over any pre-set path_to_copy_back_files.

slurm_run.py

  • --slurm_copy_back_mlc_cache — inserts an rsync -a command into the srun job after the script completes. For --slurm_isolated this is critical: the cache lives inside the temp dir cleaned up by the EXIT trap, so the copy must run inside srun before exit. For non-isolated + no explicit path, the nodes share the filesystem so the option is a no-op.
  • --slurm_copy_back_mlc_cache_path — overrides the rsync destination (defaults to ~/MLC/repos/local/cache).

Usage examples:

# Remote run: copy cache back after run
mlcr my,script --remote_host=myserver --remote_copy_back_mlc_cache=yes

# Remote run: copy to custom path
mlcr my,script --remote_host=myserver --remote_copy_back_mlc_cache=yes \
  --remote_copy_back_mlc_cache_path=/data/mlc-cache

# SLURM isolated run: preserve cache before temp dir cleanup
mlcsr my,script --slurm_isolated --slurm_copy_back_mlc_cache=yes

✅ PR Checklist

✅ Testing & CI

  • Have tested the changes in my local environment, else have properly conveyed in the PR description
  • The change includes a GitHub Action to test the script(if it is possible to be added).
  • No existing GitHub Actions are failing because of this change.

📚 Documentation

  • README or help docs are updated for new features or changes.
  • CLI help messages are meaningful and complete.

📁 File Hygiene & Output Handling

  • No unintended files (e.g., logs, cache, temp files, pycache, output folders) are committed.

🛡️ Safety & Security

  • No secrets or credentials are committed.
  • Paths, shell commands, and environment handling are safe and portable.

🙌 Contribution Hygiene

  • PR title and description are concise and clearly state the purpose of the change.
  • Related issues (if any) are properly referenced using Fixes # or Closes #.
  • All reviewer feedback has been addressed.

…m-run

Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to copy back mlc cached entry for remote-run and slurm-run Support copying back MLC cached entry for mlc remote-run and mlc slurm-run Aug 16, 2026
Copilot AI requested a review from arjunsuresh August 16, 2026 14:49
@arjunsuresh

Copy link
Copy Markdown
Contributor

@copilot can you add GitHub action tests for the new changes?

…_back_mlc_cache

Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>

Copilot AI commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you add GitHub action tests for the new changes?

Added in commit 7a84d27:

Unit teststests/test_slurm_run.py (TestCopyBackMlcCache, 11 tests):

  • remote_copy_back_mlc_cache: cache path appended, correct default destination, custom path overrides, isolated mode uses absolute tmp path, no-op when flag absent
  • slurm_copy_back_mlc_cache: isolated mode adds rsync, custom path respected, non-isolated + no explicit path is a no-op, non-isolated + explicit path adds rsync

test-mlc-remote-run.yml additions:

  • Unit test step (python -m pytest tests/test_slurm_run.py -v -k "copy_back") runs before the live SSH tests
  • Test 4--remote_copy_back_mlc_cache=yes + --remote_copy_back_mlc_cache_path with real SSH-to-localhost, verifies cache is rsynced back
  • Test 5 — same with --remote_isolated=yes (validates the isolated-mode absolute-path branch)

The test-mlc-slurm-core.yml workflow already runs the full test_slurm_run.py test file, so it picks up the new tests automatically.

@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

Copilot AI and others added 2 commits August 16, 2026 15:10
Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
@arjunsuresh
arjunsuresh marked this pull request as ready for review August 16, 2026 15:27
@arjunsuresh
arjunsuresh requested a review from a team as a code owner August 16, 2026 15:27
Comment thread automation/script/remote_run.py
Copilot AI and others added 2 commits August 16, 2026 16:19
Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com>
@anandhu-eng
anandhu-eng merged commit c9d1896 into main Aug 17, 2026
76 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support copying back mlc cached entry for mlc remote-run and mlc slurm-run

3 participants