Persist Outputs
Interactive sessions are useful for discovery, but the container filesystem is not the right long-term storage layer. Save anything important before stopping or replacing the service run.
This page continues from the Sandbox Quick Start and uses its quick-start project, /workspace directory, and RUN_UUID variable.
Persist Artifacts
Write generated files to the run's outputs path and log them with the tracking library:
from pathlib import Path
from polyaxon import tracking
from polyaxon.schemas import V1ArtifactKind
tracking.init()
report_path = tracking.get_outputs_path("reports/evaluation.json")
Path(report_path).write_text('{"accuracy": 0.91}\n', encoding="utf-8")
tracking.log_artifact_ref(
path=report_path,
kind=V1ArtifactKind.FILE,
name="evaluation-report",
)get_outputs_path() writes into the run's synced outputs directory. log_artifact_ref() records artifact metadata; it does not copy an arbitrary file into the artifact store.
See tracking artifacts for artifact logging patterns.
Download Scratch Files
If you followed the quick start, use sandbox download when a file is still in /workspace rather than the synced outputs directory. Otherwise, replace the source with an existing absolute path in the running container:
polyaxon sandbox download -p quick-start -uid $RUN_UUID /workspace/report.json ./report.jsonCommit Code Changes
If the sandbox produced code changes that should live beyond the session, push them to a Git branch using a scoped credential:
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo status
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- git -C /workspace/repo push origin HEADPreserve Reproducibility
When a manual session discovers a useful fix, move the change into a reproducible place:
- Source code in Git.
- Dependencies in an image or lockfile.
- Runtime settings in a Polyaxonfile or preset.
- Results in artifacts, metrics, or model registry entries.