Uploads (post-execution storage)
sflow can automatically upload selected files to cloud storage (S3 today; GCS/Azure are
planned as additional plugins) as each task completes. You declare named storage targets
at the top of sflow.yaml, then attach per-task uploads: specs.
Uploads run per task, on COMPLETED — partial results survive a fail-fast workflow
cancellation.
YAML shape
storage:
- name: results_bucket
type: s3
bucket: my-bench-results
region: us-west-2
prefix: "runs/${{ variables.RUN_ID }}/" # optional; prepended to every remote key
workflow:
tasks:
- name: benchmark
script: [...]
uploads:
- target: results_bucket
from: "${{ task.output_dir }}/results.csv"
to: "main/results.csv" # optional; relative to the target's prefix
on_error: fail # warn (default) | fail
- target: results_bucket
from: "${{ task.output_dir }}/*.json" # glob
on_error: warn
Field reference
Storage target
| Field | Required | Description |
|---|---|---|
name | yes | Name referenced by each upload spec's target: |
type | yes | Plugin discriminator. s3 today |
bucket | yes (s3) | S3 bucket name |
region | no | AWS region. Defaults to boto3's chain |
prefix | no | Key prefix prepended to every uploaded object |
endpoint_url | no | For S3-compatible stores (MinIO, Ceph RGW, ...) |
addressing_style | no | auto, virtual, or path. Defaults to path when endpoint_url is set, else boto3's default. Most S3-compatible endpoints require path. |
storage_class | no | S3 storage class (e.g. STANDARD_IA) |
Upload spec
| Field | Required | Description |
|---|---|---|
target | yes | Name of a declared storage entry |
from | yes | Local file path or glob. May contain ${{ }} expressions |
to | no | Remote key (relative to the target's prefix). If omitted, the local basename is used. If to ends with / it is treated as a directory and the basename is appended. When from is a glob, to must end with / (or be omitted) — a literal to: against multiple matches is rejected at validation time to avoid silent layout changes between runs. .. segments are rejected to prevent prefix escape. For replicated tasks, the basename is auto-suffixed with _${{ task.name }} unless to: already references ${{ task.name }} (see Replicated tasks). |
on_error | no | warn (default) logs and continues; fail flips the task to FAILED (and triggers fail-fast if enabled) |
Expression resolution timing
| Field | Resolved when | Available context |
|---|---|---|
Storage target fields (bucket, prefix, ...) | Assembly (once per run) | variables.*, backends.*, artifacts.* |
Upload from / to | Task completion (per upload) | task.output_dir, task.backend, task.operator, task.assigned_nodes, plus the task's env vars via env.* |
${{ task.output_dir }} resolves to the task's SFLOW_TASK_OUTPUT_DIR — the per-task subdirectory under sflow_output/<run_id>/.
Replicated tasks
When a task has replicas:, each replica runs as <task>_0, <task>_1, ... Each replica has its own task.output_dir, so from: works correctly out of the box. The destination, however, is shared: a to: of main/results.csv (or an omitted/main/-style to:) would resolve to the same remote key for every replica and silently overwrite — last-writer-wins, with no error.
By default sflow prevents this by auto-renaming each replica's upload. It inserts the replica name (${{ task.name }}, e.g. benchmark_0) into the filename, just before the extension:
to: | Replica benchmark_0 uploads to |
|---|---|
main/results.csv | main/results_benchmark_0.csv |
main/ (directory) | main/results_benchmark_0.csv |
| (omitted) | results_benchmark_0.csv |
The rename applies per file, so globs are disambiguated too (a.json, b.json → a_benchmark_0.json, b_benchmark_0.json). sflow logs a warning the first time it auto-renames a spec so the behavior is never silent.
To control the layout yourself, reference ${{ task.name }} anywhere in to:. sflow then leaves the destination exactly as written (no auto-rename, no warning):
- target: results_bucket
from: "${{ task.output_dir }}/results.csv"
to: "${{ task.name }}/results.csv" # -> benchmark_0/results.csv
Non-replicated tasks (a single replica or no replicas:) are never auto-renamed.
S3-compatible stores (MinIO, Ceph RGW)
Set endpoint_url; sflow defaults addressing_style to path, which is what most non-AWS deployments require. Example:
storage:
- name: minio
type: s3
endpoint_url: "http://minio.local:9000"
bucket: bench-results
# addressing_style: path # default when endpoint_url is set; override if needed