Run a job
Compare quotes, launch a Python script on the machine you choose, and set its project, environment, secrets, budget and policies.
Warnings and limits
- A launch uploads the directory you run it from. Files over 100 MB are left out, a project over 500 MB is refused, and files that may hold credentials (
.envfiles, private keys, cloud credential files and directories) never go up. --project NAMEis required to launch: 1 to 100 characters.- A workspace runs at most 100 jobs at once (queued and running jobs count, suspended ones do not); a launch or a resume past that is refused with
429. - Keep secrets out of
--env: its values are kept with the job's spec, not sealed like a stored secret. - A budget is a limit, not an estimate: the job is suspended (or stopped) a little before it is spent, and a job whose budget is spent cannot be resumed or moved.
- Ctrl-C detaches from the output. It does not stop the job;
fluid stop JOBdoes. - Project requirements that are not pinned resolve when each machine boots, so two machines can install different versions. Pin them when that matters.
- The job's environment installs Fluid's own dependencies (
dill,cloudpickleand the rest) as compatible ranges, so your pins win. Requirements that cannot resolve together fail the environment build, and the job's error carries uv's reason. - On Modal the environment is an image built on first use, 30 minutes at most for the requirements; a build that fails is built once more afresh before the job fails.
Quote, then launch
Without --on, fluid run only compares quotes. Nothing is uploaded and nothing starts:
fluid run train.py --gpu T4Pick a quote and launch it with its exact spec:
fluid run train.py --gpu T4 --on SPEC --project training -d| Option | What it does |
|---|---|
--on SPEC | launch on exactly this offer, as a quote printed it |
--project NAME | the project the job belongs to: required to launch; fluid ps and the console group jobs and their costs by it |
--name NAME | a name to refer to the job by (1 to 100 characters) |
-d, --detach | return once the job is queued, instead of following its output |
--plan | only show quotes, even with --on |
Requirements narrow the quotes: --gpu takes a model (T4, L4), a memory per GPU (24G) or any; --gpus N, --cpus N and --mem GB set minimums; --spot asks for spot only and --no-spot for none (by default spot is used when offered); --providers aws,modal limits the providers; --regions us-east-1,eastus limits the regions, 64 names at the most. Each cloud is asked only for its own regions, so one list can name several clouds'. A name that is no region of any cloud the run may use is refused by name. --ranks N starts N processes of the script that train together, one per GPU: see Train on several GPUs. Arguments for your script go after --:
fluid run train.py --gpu T4 --on SPEC --project training -- --epochs 10 --lr 3e-4A job launched with an exact --on stays on that machine type: Fluid does not move it to a cheaper offer or back to spot. Notices, out-of-memory rescues, provider time limits, budgets, idleness and the time limit still apply. See What Fluid does on its own.
The example job
With no script at hand, --example runs Fluid's example job in place of one. It comes with the CLI, so it needs no file of yours, and nothing from the directory you run it in is uploaded:
fluid run --example --gpu T4
fluid run --example --gpu T4 --on SPEC --project demoThe example prints the machine's GPU, counts 15 steps over about 45 seconds, says its result and ends. The result is its steps, the seconds they took and the number of GPUs it found, printed as a result line, so the run's page and fluid status show one. It imports only Python's standard library, so its environment has nothing to install. Every other option works as with a script, and the job is named example unless you give --name. A script with --example is refused: give one or the other. A coding agent runs it with the run tool's example field.
An exact spec names only what its provider makes. A spec that names anything else is refused with what to name instead, at the quote and before any machine starts. Change the spec; sending it again gives the same answer.
| Provider | A spec may name | Refused |
|---|---|---|
| AWS EC2 | an instance type, spot, region=, zone=, disk_gb= | a spec with no instance type |
| AWS Fargate | cpu=, memory_gb=, region=, spot, arch= | gpu=, a machine type, disk_gb=: a task has no GPU, and its disk follows its memory |
| Azure VMs, Google Cloud | a VM size or machine type, spot, region=, disk_gb= | |
| Azure Container Apps | gpu=T4 or gpu=A100, or cpu= and memory_gb= | spot, a location other than its environment's, disk_gb= with a GPU |
| Modal | gpu= (with x2 to x8), cpu=, memory_gb=, region=, mode= | disk_gb=: Modal sets the disk |
| Lambda Cloud | an instance type from its listing, or gpu= a model the listing has | disk_gb=, a type or GPUs the listing does not have |
| Your own machine | gpu= a model the machine reported | spot, region=, disk_gb=, a GPU model it did not report |
Name a GPU once: a spec that names two that differ is refused. The offer for an exact spec shows the vCPUs and memory of the machine it starts, whatever numbers the spec names.
What is uploaded
The directory you run fluid run from, with the script in it, is packed and uploaded. Left out:
.git, virtual environments,__pycache__, compiled Python and tool caches;- whatever your
.gitignorefiles leave out; - files that may hold credentials:
.envand*.envfiles,.envrc, private keys and certificates,.netrcand similar files,.aws,.ssh,.config/gcloudand similar directories, and JSON files holding a"private_key"; - files over 100 MB;
- links that point outside the directory.
A .portalignore file uses .gitignore's syntax on top of them: a pattern leaves more out, and a !pattern brings a path back, including a credential file you name exactly or a file over 100 MB. A project over 500 MB in all is refused: keep large data in storage your script downloads.
Paths
Your script runs on the machine in a copy of the uploaded directory, which is its working directory. Relative paths behave as they do on your computer. Write what you want to keep inside that directory: it is the job's output when the job ends. See Outputs and logs.
Python and requirements
Fluid reads what your project declares, in this order: requirements.txt; else pyproject.toml's [project].dependencies; else your uv.lock; else the imports of your .py files, mapped to the packages that provide them. Lines that point at files on your computer (-e, -c, local paths) are left out. A requirements.txt may include other files with -r when they are inside the same git repository as the project, so -r ../base.txt works in a repository. With no git repository around the project, the included files must be inside the project directory. A repository at your home directory does not count. An include that leads outside that bound, or to a file or folder whose name starts with a dot, stops the command with an error that names the bound: the lines Fluid reads are sent with the job, so it reads none from outside the project's repository. Copy the lines you need into a file inside it.
The job runs on Python 3.12, or 3.13 or 3.14 when .python-version names that minor version. Other versions are refused. GPU jobs get PyTorch's CUDA 12.6 build unless your requirements pin another build (+cu128, +cpu) or name a PyTorch index.
Environment variables and secrets
fluid run train.py --on SPEC --project training --env BATCH=64 --env MODE=fast--env K=V sets a variable for the script. Its value is kept with the job's spec, so never use it for a secret. Every machine the job runs on starts it with these variables, after a move or a resume too.
A PYTHONPATH you set this way works as it does on your computer: --env PYTHONPATH=src puts your project's src on your script's import path, read against the job's working directory, on every machine the job runs on. Keep the directories it names inside the project: one outside it is not carried when the job moves.
Fluid starts every process of a job with PYTHONHASHSEED=0, on every machine the job runs on, so a string hashes to the same number before and after a move. To choose the seed yourself, set it with --env PYTHONHASHSEED=7 (a whole number from 0 to 4294967295, or random for a different one in every process). A set can still give its members in another order after a move: see Known limits.
For a secret, store it once and pass it by name:
fluid secrets set HF_TOKEN # asks for the value, without showing it
fluid secrets set HF_TOKEN --from-env HF_TOKEN
fluid run train.py --on SPEC --project training --secret HF_TOKENThe value is read privately from the terminal or standard input, never from an argument. A workspace keeps at most 64 secrets, 16 MiB sealed in all. Storing or deleting a secret needs a sign-in from the last 5 minutes. A secret name is letters, digits and _, does not start with a digit, and is at most 128 characters.
The script reads a stored secret as an environment variable of that name, on every machine the job runs on: Fluid gives it again wherever the job moves or is resumed. A checkpoint never holds a secret's value. If you delete a secret that a running or suspended job uses, the job is not moved or resumed until you store it again: the refusal names the secret.
Budgets
fluid run train.py --on SPEC --project training --budget 25--budget USD is optional. Fluid acts a little before the job's estimated cost reaches it: when cost plus 2 minutes of the machine's price would pass it, the job is suspended, its machine released, and it waits until someone resumes it. A suspension that fails stops the job. A job whose budget is spent is refused a resume or a move. See Spend caps and budgets.
What Fluid tells you, before and after
Quotes come with warnings when there is something to know before you go ahead, and the job's events repeat them: the account's quota for the machine type when it admits only one such machine at a time ("the account's vCPU quota L-DB2E81BA in us-east-1 is 4 vCPUs: 1 g4dn.xlarge at a time"), or that the quota could not be read; a price that is an estimate rather than an exact quote; the budget a fixed-limit provider reserves up front (see Spend caps and budgets); and, in the job's provisioning event, how long the machine usually takes to boot. A spot machine's warning says what its notice can save of the job's memory. When the job ends, its last events name where its output is (fluid logs JOB for the log, fluid pull JOB for the files, kept 7 days) and the cost, saying when part of it is unknown, and the saving.
Policies for one job
| Option | What it does |
|---|---|
--no-cheaper | never move to a cheaper offer on its own |
--no-return | never move back to spot when that pays |
--no-evacuate | no checkpoint and suspension on a spot notice |
--rightsize on_move|active|off | how CPU and memory follow the job's measured use |
--policy KEY=VALUE | any policy setting, such as idle.after_min=60 |
The time limit (ttl.hours, 72 by default, for example --policy ttl.hours=24) counts the time machines run the job: a running job is stopped once it has run that long, and time suspended does not count toward it. A suspended job has a limit of its own, the same number of hours counted from the job's creation on the clock: past it the job ends ("time limit of 72 h reached while suspended"), its checkpoint is kept for 7 days, and fluid resume JOB continues it from there within those days. See Suspend and resume.
A portal.yaml in the project can hold the same policy settings; flags take precedence over it. See Settings.
When the GPU you asked for is not available
A GPU can be scarce: Modal schedules an L4 when one frees up, and EC2 refuses a type a zone has run out of. Fluid waits a bounded time (5 minutes on Modal, EC2's capacity rounds), says what it is waiting for in the job's events every minute, and then ends the job as no_capacity with choices: that provider's other GPUs with their prices, the same machine on-demand, or spot elsewhere. It never picks another machine on its own.
If you would rather the job ran than waited for your choice, say so up front:
fluid run train.py --on modal:gpu=L4 --gpu-fallback same_provider --project training
fluid run train.py --on modal:gpu=L4 --gpu-fallback any --project trainingsame_provider runs on that provider's cheapest other GPU of the job's size (its GPU count and the memory per GPU you asked for); any on the cheapest GPU of any provider your requirements allow. The quotes say up front what that would be and what it costs, more or less than the GPU you asked for ("gpu_fallback=same_provider: if L4 (modal, $0.800/h) is not scheduled within Fluid's bounded wait (5 min on Modal), the job runs on T4 (modal, $0.590/h) instead, $0.210/h less, and is pinned there"), and the job's events then say exactly what happened: "L4 not scheduled in 5 min on modal; running on T4 (modal, $0.590/h) instead, as asked by gpu_fallback=same_provider: $0.210/h less than L4's $0.800/h; the job is pinned there (fluid move moves it)". A job that fell back is pinned to that machine, whether or not you launched it with --on, so no automatic move takes it back to the GPU that was not there; fluid move moves it when you want. The fallback itself gets no fallback: if that GPU is not available either, or the job's budget cannot pay for it, the job ends with the choices for the GPU you asked for. fluid move JOB --to SPEC --gpu-fallback MODE does the same for a move.
From a coding tool
The MCP tool run takes the same choices: the script, its arguments, requirements, on, project, env, secrets, budget_usd, gpu_fallback and policies. It uploads only a directory inside the one the MCP server started in, or one you added with fluid mcp --root DIR. A requirements.txt that includes another file with -r is read the same way under the MCP server: the included file must be inside those directories too, even where it is in the project's git repository. Add the directory with fluid mcp --root DIR, or copy the lines into a file inside. See MCP tools.
Quotas and capacity
What your provider's quotas and capacity mean for a launch, what Fluid checks, and what happens when a machine is not available.
Train on several GPUs
Run one process per GPU on one machine or across a group of AWS EC2 or Google Compute Engine machines. Move the ranks together as one job.