Skip to content

Publish team Torch experiments to OSN by default - #859

Open
YuanYuan98 wants to merge 6 commits into
mainfrom
u/yuanyuan/public-experiment-publishing
Open

Publish team Torch experiments to OSN by default#859
YuanYuan98 wants to merge 6 commits into
mainfrom
u/yuanyuan/public-experiment-publishing

Conversation

@YuanYuan98

@YuanYuan98 YuanYuan98 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Part 2 of #711. This PR can be reviewed and merged before the historical backfill work in #858.

Goal

Keep /scratch as the live training filesystem while archiving team Torch experiment runs to the public OSN research archive by default. A user can explicitly opt out for a private run. Samudra generic configuration, SkyPilot, and third-party workflows are unchanged.

What changed

  • add the single-run archive helper used by Torch jobs
  • default the team Torch harness to PUBLISH_TO_OSN=1; set it to 0 to opt out
  • namespace every public run as <owner>/<run-name>; owner defaults to the Torch $USER and can be overridden with ARCHIVE_OWNER
  • perform an authenticated, verified archive preflight before training
  • incrementally copy only $RUN_DIR every 15 minutes
  • publish a final verified snapshot for completed, failed, and requeued jobs
  • write archive-status.json with owner, lifecycle, and Slurm metadata
  • reject an owner change when resuming the same run
  • preserve the training exit code; fail a successful job if its final publication fails
  • document credentials, the explicit opt-out, and public-data safety boundaries

The default destination is nyu-osn:m2lines-pubs/Samudra/experiments/<owner>/<run-name> (s3://m2lines-pubs/Samudra/experiments/<owner>/<run-name>). The archive uses copy/check operations only. It does not turn OSN into output_base, delete scratch data, publish the whole scratch tree, or migrate historical runs.

Verification

  • uv run pytest tests/test_experiment_archive.py (21 passed)
  • focused pre-commit hooks (all passed)
  • uv run mypy scripts/experiment_archive.py
  • Python 3.6 grammar check for the Torch host-side tool
  • bash -n scripts/slurm_apptainer_train.sbatch
  • git diff --check

A credentialed Torch/OSN smoke run remains an operator step after review.

@YuanYuan98
YuanYuan98 force-pushed the u/yuanyuan/public-experiment-publishing branch from 4da3160 to c588cd3 Compare August 25, 2026 14:08
@YuanYuan98
YuanYuan98 force-pushed the u/yuanyuan/public-experiment-publishing branch from c588cd3 to 2cc3a98 Compare August 25, 2026 14:13
@YuanYuan98
YuanYuan98 changed the base branch from u/yuanyuan/public-experiment-backfill to main August 25, 2026 14:13
@YuanYuan98 YuanYuan98 changed the title Publish opted-in Torch experiments to OSN Publish team Torch experiments to OSN by default Aug 25, 2026
@YuanYuan98

Copy link
Copy Markdown
Collaborator Author

@copilot may i have your review?

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@copilot may i have your review?

I reviewed this PR. The recent Test GPU failures are infrastructure-related (InsufficientInstanceCapacity when launching g6.xlarge) rather than caused by these code changes. I don’t have additional code changes to request right now.

@YuanYuan98
YuanYuan98 marked this pull request as ready for review August 25, 2026 15:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34eac9557c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/experiment_archive.py
Comment thread scripts/experiment_archive.py
Comment thread scripts/slurm_apptainer_train.sbatch Outdated
@YuanYuan98

Copy link
Copy Markdown
Collaborator Author

Addressed all three automated review findings in 80e765b1:

  • reject nested/unsafe configured run names before deriving RUN_DIR;
  • exclude the actual saved_nets/tmp* atomic checkpoint files;
  • quarantine (rather than delete) an unstarted fresh run after archive preflight failure, while preserving requeued runs.

Also added a fresh-run OSN destination collision check so publication cannot silently merge into an existing owner/run prefix.

Validation: 28 archive tests passed, full CPU suite passed (437 passed, 2 skipped, 10 xfailed), and pre-commit passed.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80e765b1de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/experiment_archive.py
@YuanYuan98

Copy link
Copy Markdown
Collaborator Author

Fixed the credential-bearing repository URL finding in c859d25d. Authenticated fetch URLs are now sanitized before any log, manifest, W&B metadata, or public provenance is written, including legacy code-layer and container metadata.

Validation: 35 focused archive/security tests passed; full CPU suite passed (444 passed, 2 skipped, 10 xfailed); pre-commit and detect-secrets passed.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c859d25d75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +151 to +155
result = subprocess.run(
command,
check=True,
stdout=subprocess.PIPE,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reserve the archive destination atomically

When two fresh jobs use the same ARCHIVE_OWNER and NAME but different local OUTPUT_BASE paths, both can observe an empty destination here before either reaches the initial publish in initialize_archive. Both jobs then train and periodically copy into the same archive prefix, merging checkpoints and lifecycle metadata from unrelated experiments. Replace this check-then-copy sequence with an atomic reservation or destination lock.

Useful? React with 👍 / 👎.

@alxmrs alxmrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick note, but will make a full review later today or tomorrow.


"""Publish Samudra experiment run directories to an rclone archive.

The CLI is deliberately dry-run by default. ``--apply`` is required before it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐑 I prefer the opposite default, where you add --dry-run to test things out but by default it does what you intent.

@alxmrs

alxmrs commented Aug 27, 2026

Copy link
Copy Markdown
Member

I have a high level question about this PR: is it possible to directly write to the OSN pod from torch without writing to local disk first? Would that slow down the training process?

Maybe we can meet a bit after our Monday weekly sync and discuss this PR / ideas that could help us implement a solution for the sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants