Factories
A machine that stays up between runs, and keeps its disk.
A factory is a machine that outlives the thing it is running. Deploy one and it
stays there: you can shell into it, redeploy to it, suspend it and bring it
back with its /workspace disk intact.
Use one for anything without a natural end — an inference endpoint, a long-lived development box, a service you redeploy from a repository on every push.
factor deploySandbox or factory?
| Sandbox | Factory | |
|---|---|---|
| Ends when | your script exits, then waits suspended | you stop it |
| Files | not kept between runs | /workspace kept across suspends |
| Billed | while the script runs | while running; only the /workspace disk while suspended |
| Shell into it | no | yes |
| Redeploy on a push | no | yes |
| Good for | training, batch, experiments | serving, dev boxes, anything long-lived |
If the work has an end, you want a sandbox. It costs less and there is nothing to forget about.
Deploying one
A factory is described by a manifest:
version: 1hardware: 24gb-class:1zone: eusetup:- pip install -r requirements.txtrun: python serve.pyidle_timeout: 30mfactor deployEach factor deploy creates a new factory, with its own machine and disk. To
update one in place, connect it to a repository: a push
redeploys it on the same machine, keeping the disk.
The lifecycle
factor list # what you havefactor shell fac_01M0AM… # get on itfactor logs fac_01M0AM… -f # what it is printingfactor stop fac_01M0AM… # suspend: /workspace kept, compute billing stopsfactor start fac_01M0AM… # resume, /workspace intactfactor rm fac_01M0AM… # terminate permanently, disk includedStopping releases the GPU so it stops billing — which also means the card is
not held for you. start needs a card of the same kind free in the factory's
zone; if none is, it says so (no capacity to resume) and you try again a
little later. Suspending takes several minutes and waking takes a few more, so
stop a factory you are done with for the day, not for a coffee. For something
that must always answer, leave it running with idle_timeout: 0.
What survives a stop
Only /workspace. Everything else in the container is reset when it starts
again, and your setup steps run again; /scratch is wiped. Keep models,
caches and data in /workspace:
env:HF_HOME: /workspace/huggingface/workspace lives on the machine's own 100 GB system disk, which is kept whole
while the factory is stopped. While stopped, that disk costs $0.07 per GB per
month at the provider, plus your plan's margin; while running it is included in
the machine's price.
Idle timeout
idle_timeout: 30mThe factory suspends itself after that long with nothing running, and you stop
paying for compute. Set 0 to never suspend — appropriate for something
serving traffic, expensive for a dev box you forget about on a Friday.
The shell
factor shell fac_01M0AM…A real interactive shell on the running machine. There is no inbound port open on it: the machine dialled out to us, and your keystrokes travel back down that connection. Nothing is listening on the pod for anyone to find.
You are the same unprivileged user your workload runs as.
Deploying from GitHub
Connect a repository to a factory and a push redeploys it. The factory has to exist first — a push never creates a machine, because that would let a commit message allocate billable hardware.
Reaching it over the network
List the ports your server listens on under ports:, and each gets a public
HTTPS address — no tunnel, no extra account:
version: 1hardware: 24gb-class:1setup:- pip install -q fastapi uvicornrun: uvicorn app:app --host 0.0.0.0 --port 8000ports:- 8000factor deploy prints the address, factor info <id> prints it again, and the
machine's page in the dashboard links it:
$ factor info fac_01K7QW3M8N2P5RTV9XZ4B6CDEFPort 8000 https://p8000.38-80-123-24.sslip.ioThe address is assigned once the machine is up, a minute or two after
factor deploy returns; until then factor info says so. It is the machine's
own public IP, served over HTTPS with a certificate obtained automatically.
- Listen on
0.0.0.0. A server bound to127.0.0.1— the default of many frameworks — cannot be reached, and the address answers 502. - Ports 1024 to 65535, at most five. Your program runs unprivileged, so it cannot bind 80 or 443; the public address is HTTPS on 443 whatever the port inside.
- HTTP only, websockets and server-sent events included.
- The address answers once your server is listening — after setup and model
loading — and stays the same across
factor stopandfactor start. portsis fixed when the factory is created. Factories only: a sandbox stops when its command does.
Costs
Billed per second while running. Stopped, you pay only for the disk it keeps — 100 GB at $0.07 per GB a month, plus the margin of your plan. Terminated, nothing.
factor billing balancefactor stats # spend and reliability, per machine