Skip to content

Storage and files

Mount a bucket or a volume

volumes takes mount strings: s3://<bucket name>:/container_path[:mode] for an Object Storage bucket, or source:container_path[:mode] for a bucket id (storagebucket-...) or a filesystem. The mode is ro or rw (default rw).

job = ns.Job(
    command=["python", "train.py"],
    image="registry.example.com/team/trainer:1.4",
    gpu="h100",
    timeout="24h",
    volumes=[
        "s3://my-data:/workspace/data:ro",
        "s3://my-results:/workspace/results:rw",
    ],
)

Nebius mounts a bucket by its id. So on create() and dry_run(server=True), each bucket name is looked up in the job's or endpoint's project, and its id is sent. A bucket that doesn't exist, or that your account can't see, raises AccessError naming it, before anything is created. The lookup needs the right to view Object Storage buckets in the project. A bucket id or a filesystem is sent as it is, with no lookup. dry_run() without server=True makes no lookup and shows the name as given. to_cli() prints the name too: the nebius CLI takes s3://<bucket> itself.

An s3:// string with a fourth :profile part raises UnsupportedFeature. A stopped endpoint is not billed for compute or its disk, but mounted volumes still bill.

Write to local disk, then copy to the bucket

Some tools append to files as they run, which the S3 mount does not support. Axolotl's debug.log is one. Write outputs to the container's local disk and copy them to the mounted bucket when the command ends, as the Axolotl examples do.

A preempted job then starts over, because its local disk is gone. That is fine for a short run. For a long one, mount a shared filesystem and write the outputs there: it supports appends, so Axolotl can save checkpoints to it and resume from the last one with auto_resume_from_checkpoints: true.

The task bucket

Tasks keep their code, arguments, results and files in one bucket: the project's ns-workspace-<project id>, created on the first run. It is not configurable. Plain jobs and endpoints do not use it.

ns-workspace-<project id>/
├── libs/<hash>.tar.gz           task code archives
├── tasks/<task>/<run>/          a task called on its own
└── flows/<flow>/<run>/<job>/    tasks inside a Prefect flow

Each run folder holds payload.json (its arguments), its result, and files/, which is $NS_OUTPUT_DIR in the job. Every task job mounts the bucket at /ns. The details are in Files and the task bucket.

Every task job can write the whole bucket

Task jobs mount the whole bucket read-write at /ns, so a job can read and overwrite any run in it. Keep data you must protect in another bucket, and mount that one with volumes.

Disk

disk is a CLI size string, passed through, such as 500Gi. When omitted, the request uses 250Gi.

Shared memory

shm sets /dev/shm in the disk syntax, such as 64Gi, or 0. An integer is taken as bytes. When omitted, a GPU machine gets 16Gi and a CPU machine sends none, matching the CLI's --shm-size default. Raise it for data loaders and multi-GPU training that need more.

Small files from your machine

inject_files takes CLI --inject-file strings: local_path:container_path. Each local file is read on create, not when the job is built, sent as container content, and must be at most 64 KiB. A dry run lists the strings and does not read the files. inject_files is not a YAML key.

job = ns.Job(
    command=["python", "/app/run.py"],
    image="python:3.12-slim",
    timeout="30m",
    inject_files=["run.py:/app/run.py"],
)

Working directory

working_dir sets the container working directory, at most 128 characters. When omitted, the image WORKDIR applies.