Remote Storage¶
Share cached pipeline outputs across machines using S3 or Google Cloud Storage (GCS). Push outputs from your laptop, pull them in CI or on a teammate's machine — stages with matching cached outputs skip instead of re-running.
Prerequisites¶
Install Pivot with the extra for your storage:
Credentials come from each cloud's standard chain; see Credentials.
Configure a Remote¶
# Add an S3 remote
pivot config set remotes.origin s3://my-bucket/pivot-cache
# Or a GCS remote
pivot config set remotes.origin gs://my-bucket/pivot-cache
# Set it as default
pivot config set default_remote origin
Verify with:
The remote URL is s3://bucket/prefix or gs://bucket/prefix; any other scheme is rejected when the config is set or loaded. Pivot stores cached files under this prefix, organized by content hash (<prefix>/files/ab/cdef… for hash abcdef…), the same layout on both clouds.
Push Outputs¶
After running your pipeline locally, upload cached outputs to the remote:
Output:
Selective Push¶
# Push outputs from specific stages only
pivot push train
# Push a specific file
pivot push model/best.pkl
# Preview what would be uploaded: the files the remote does not hold yet
pivot push --dry-run
# More parallel uploads for large caches
pivot push --jobs 40
Options¶
| Option | Description |
|---|---|
-r, --remote |
Target a named remote instead of the default |
-n, --dry-run |
Show what would be pushed without uploading |
-j, --jobs |
Number of parallel upload threads |
Pull Outputs¶
On another machine, download cached outputs and restore them to the workspace:
pivot pull combines two operations: fetch (download from the remote to local cache) and checkout (restore files from local cache to workspace). This mirrors git pull = git fetch + git merge.
After pulling, pivot repro skips stages whose outputs are already present and match their lock file hashes.
Every downloaded file is checked against the hash it is stored under before it enters the local cache. A file that does not match is discarded and counted as failed (Hash mismatch: expected …, got …), and pivot pull exits without restoring anything. To repair the remote, delete that object from it, then run pivot push on a machine whose cache has a good copy and has not run pivot push, pivot pull, pivot fetch, or pivot status --remote against this remote for this object, nor completed a stage whose pivot.read_by_hash downloaded it from this remote. Pivot records hashes those commands upload, download, or find, and those a stage's reads downloaded when the stage completes (not when it fails), then skips recorded hashes. If every machine with a good copy has recorded it, delete <state dir>/state.lmdb/ before pushing; this also clears run history and local caches. The check catches corruption in storage or transfer. It does not authenticate who wrote the file.
Selective Pull¶
# Pull outputs for specific stages
pivot pull train
# Pull a specific file
pivot pull model/best.pkl
# Preview what would be downloaded
pivot pull --dry-run
Options¶
| Option | Description |
|---|---|
-r, --remote |
Pull from a named remote instead of the default |
-n, --dry-run |
Show what would be downloaded |
-j, --jobs |
Number of parallel download threads |
-f, --force |
Overwrite existing workspace files |
--only-missing |
Only restore files that don't exist on disk (the default without --force); a directory is replaced when every changed or extra file is pivot's own earlier output (an extra empty directory holds nothing to lose), and refused (naming the files) when one holds a local change the cache lacks |
--checkout-mode |
symlink, hardlink, or copy (default: project config) |
Fetch and Checkout Separately¶
For more control, split the two steps:
# Download to local cache only (no workspace changes)
pivot fetch
# Restore from local cache to workspace
pivot checkout
This is useful when you want to pre-populate the cache without touching the working tree, or restore specific files after fetching.
# Fetch everything, then selectively checkout
pivot fetch
pivot checkout model/best.pkl
pivot checkout --only-missing
What Gets Transferred¶
| Data | Pushed/Pulled | Version controlled |
|---|---|---|
Cache files and directory listing objects (<state dir>/cache/files/) |
Yes | No (.gitignore) |
Lock files and directory listings (<state dir>/stages/**/*.lock, <state dir>/stages/**/*.listing) |
No | Yes (commit both) |
Config (.pivot/config.yaml) |
No | Yes (commit this) |
<state dir> is core.state_dir, which defaults to .pivot.
Lock files and listings are the bridge. A lock maps each stage output to a content hash; a directory's members are in its committed listing file. Push uploads the listing object and the files it names; pull downloads them. Always commit lock files and their listing files so other machines know what to pull.
Pushing and pulling a target transfer the same files: the ones pivot checkout of that target restores, plus the objects a stage read with pivot.read_by_hash (its lock lists them under reads). A mapped stage instance also carries the producer listing a clone needs to expand it; fetch and pull get that listing only for the mapped stages the targets name, count it in their summary, and fail naming it when the remote lacks it. Pulling a stage does not fetch the outputs of the stages upstream of it or its inputs tracked with pivot track: checkout does not need them, but without them a later pivot repro recomputes those upstream stages, or stops naming a tracked input that is missing. Name them as targets too, or run an untargeted pivot pull, which fetches every file on the remote. No pull fetches raw inputs committed to git (data/raw/...), metric outputs (git carries both), or files brought in with pivot import: those come from the source repo's remote, and pivot update refreshes them.
A target that is not a stage, stage output or tracked path fails, naming it. A push that cannot send a file the remote lacks, because the local cache no longer holds it, fails and names the file's hash. pivot status --remote counts the files an untargeted push would upload and the files on the remote that the local cache lacks, so a fresh clone sees every file a pull would download.
Multiple Remotes¶
# Add a second remote (remotes may be on different clouds)
pivot config set remotes.backup gs://backup-bucket/pivot-cache
# Push to a specific remote
pivot push --remote backup
# Change the default
pivot config set default_remote backup
List configured remotes:
Credentials¶
No Pivot-specific credential configuration is needed: each cloud's standard chain applies.
S3 uses the standard AWS credential chain:
- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - AWS credentials file (
~/.aws/credentials) - IAM roles (EC2, ECS, Lambda)
- SSO/profile via
AWS_PROFILE
If aws s3 ls works, pivot push works.
GCS uses Application Default Credentials:
- A service account key file named by
GOOGLE_APPLICATION_CREDENTIALS - Your user credentials from
gcloud auth application-default login - The attached service account on GCE, GKE, or Cloud Run (metadata server)
Pivot needs storage.objects.get and storage.objects.list to pull (Storage Object Viewer grants both). Pushing also needs storage.objects.create and storage.objects.delete: a push can overwrite an object that is already there (two machines pushing the same output at once, or a retry after a reply was lost), and an upload that overwrites an object requires storage.objects.delete (IAM permissions for JSON methods, Objects: insert). A create-only grant such as Storage Object Creator is therefore not enough; Storage Object User grants all four (IAM roles). STORAGE_EMULATOR_HOST points Pivot at a GCS emulator such as fake-gcs-server, which needs no credentials.
remote.retries, remote.connect_timeout, and remote.jobs apply to both clouds.
GitHub Actions¶
For a complete GitHub Actions workflow, see the CI Integration guide. The key remote commands for CI are:
# In CI: pull cached outputs before running
pivot pull || true
# After successful run on main: push to remote
pivot push
Typical Team Workflow¶
Developer (local):
# Iterate on a feature branch
pivot repro
pivot push
git add "<state dir>/stages"
git commit -m "Update pipeline outputs"
git push
CI (after merge to main):
Teammate (pulling latest):
Troubleshooting¶
Push/pull fails with access denied:
aws sts get-caller-identity # S3: verify credentials
aws s3 ls s3://your-bucket/ # S3: verify bucket access
gcloud auth application-default login # GCS: refresh Application Default Credentials
gcloud storage ls gs://your-bucket/ # GCS: verify bucket access
A GCS permission error names the object and the missing permission, for example Permission 'storage.objects.create' denied.
Cache miss after pull — stages re-run unexpectedly:
Lock files may be out of sync. Ensure the lock files under <state dir>/stages/ are committed:
Slow transfers:
Increase parallelism:
Or set the default: pivot config set remote.jobs 40.
Related¶
- Caching — content-addressed caching and skip detection
- Cross-Repo Import — import artifacts from other Pivot projects
- CI Integration — more CI patterns and providers