// MANAGED JOBS

Managed jobs

Coming soon: managed jobs aren't switched on for MatMul accounts yet. This page describes how they work so you can plan for them. Until then, rent an instance and run your command over SSH.

What a job is

An instance is a machine you keep until you delete it. A job is a command: MatMul finds the cheapest machine that fits, runs your setup and your command on it, keeps the logs, and releases the machine as soon as the command ends. You pay for the machine time in between.

matmul run --gpu H100 --max-price 3.50 --wait -- python train.py

Is it on?

Ask the API. The CLI does this before every matmul run:

curl -s https://api.matmul.cloud/v1/capabilities -H "Authorization: Bearer $MATMUL_API_KEY"
{"instances": true, "app_links": false, "jobs": false}

While jobs is false, matmul run stops with a message and the /v1/jobs endpoints return 503.

Launching

matmul run --name train --gpu H100 --gpus-per-node 2 --max-price 7 \
  --setup "git clone https://github.com/you/repo && pip install -r repo/requirements.txt" \
  --env WANDB_API_KEY=... \
  -- python repo/train.py --epochs 3

Everything after -- is the command. The same spec over the API is a POST /v1/jobs/ body:

FieldCLI flagRules
name--nameRequired. ^[a-z][a-z0-9-]{0,15}$. The CLI makes one up if you don't.
runafter --Required. Up to 20,000 characters.
setup--setupRuns once before the command. Up to 20,000 characters.
envs--envUp to 50. Values go to the machine and aren't stored; only the names are kept.
num_nodes--nodes1 to 8 machines (default 1).
resources.accelerators--gpu, --gpus-per-nodePer machine, like H100 or H100:2.
resources.cpus--cpus4 or 4+.
resources.memory--memoryGB, 16 or 16+.
resources.disk_size--disk10 to 2048 GB.
max_hourly_price_cents--max-priceCeiling for the whole job, all machines together (the CLI takes dollars).

Nothing else is accepted: no file uploads, mounted storage, working directories or choice of cloud. Get your code onto the machine in setup, for example with git clone or pip install.

Price, balance and limits

Following a job

matmul ls                  # all jobs: state, GPU, $/hr, runtime, cost
matmul status train        # one job
matmul logs train          # its logs, also after it ends
matmul down train          # stop it and release the machine

Refer to a job by name (the most recent job with it) or by its job_... id. With --wait, matmul run prints a line on each state change, then the logs, and exits 0 if the job succeeded and 1 if not, so it works in CI.

StateMeans
launchingQueued or provisioning; detail says which.
runningYour setup or command is running.
succeededThe command exited 0.
failedIt exited non-zero or couldn't start; error says why.
cancelledStopped with matmul down, or by a freeze past the grace period.
finishedThe machine went away after the command ran, before its exit status was read.

The same operations are in the Python SDK (launch, wait, logs, down) and the REST API.

← All docs