Compute units

One compute unit is one second of solver time. The engine estimates the solver time of a run before it runs, and the run costs that many units, rounded up to a whole second, at least one. You can read how many units you have left today, how many you used, and a list of every change to your balance.

Every plan has a daily allowance. Free has 600 units a day (10 minutes of solver time). Pro has 10,800 units a day (3 hours). The units come back at midnight UTC. See the pricing page.

See what you have left

python
from thrustlab import Client

client = Client()

balance = client.compute_units.balance()
print(balance["total"], "left today")

The balance holds these fields:

  • total is what you have left today, as a whole number.
  • unlimited is always false.
  • breakdown splits the total into parts. Each part has a type, which is "free" or "monthly", a balance and an expires_at.

See your recent use

python
usage = client.compute_units.summary()
print(usage["used"], usage["window"], usage["resets_at"])

used is what you have used today. window is "day": the UTC calendar day. cap and remaining are your plan's daily allowance and what is left. resets_at is the next midnight UTC, when the units come back.

Read the history

python
for entry in client.compute_units.transactions(limit=50):
    print(entry["created_at"], entry["type"], entry["amount"])

Each entry is one change. type says why: simulation_debit or sweep_debit for a run, refund when a canceled run gave units back, or a grant such as signup_grant or monthly_grant. resource names the run behind it, and balance_after shows the balance once the change was made.

Pass credit_type="free" or "monthly" to see one kind. The list is newest first, and Pagination shows how to loop over it.

When you run out

A run that needs more units than you have left today fails with an APIError whose http_status is 402. The code is credits_insufficient, and details has units (what the run needs) and left. A run that needs more than your plan's whole daily allowance fails with http_status 422 and the code run_too_large. Canceling a run that is still waiting gives its units back.

Before you submit a big sweep, you can ask how many units it needs with client.simulations.estimate(). See Simulations.

Compute units work the same way over the HTTP API. See Compute units.