Usage on an Invocation#
After a Task Invocation reaches terminal state and backend settlement is available, invocation.usage contains the resource-usage projection. It may be None before that state arrives, and individual optional measurements can also be absent.
The current fields are:
| Field | Unit or meaning |
|---|---|
cpu_core_seconds | CPU core-seconds |
memory_gib_seconds | GiB-seconds of memory |
memory_peak_bytes | Peak observed memory in bytes |
memory_average_bytes | Average observed memory in bytes |
duration_seconds | Execution duration in seconds |
gpu_type | GPU type when applicable |
gpu_seconds | GPU seconds when applicable |
Read the projection after awaiting the result or a terminal status:
invocation = await transform.remote_async(payload)
try:
await invocation.result()
except yak.InvocationExecutionError:
pass
usage = invocation.usage
if usage is not None:
print(usage.get("cpu_core_seconds"), usage.get("duration_seconds"))
The projection contains aggregate settled measurements. It is not a time series and does not describe per-second samples.
Requests, limits and observations#
Task CPU and memory declarations are requests and optional hard limits. They describe the capacity requested for the Task and the bounds Yak should enforce. Invocation.usage describes measurements settled for one completed Invocation. These are different values and should not be substituted for one another.
The SDK currently exposes this usage projection for observation. It is not a price estimate, invoice or promise that a particular measurement is billable. Pricing, credits and payment behavior are outside this guide.
See the Task guide for resource declarations and Logs, Results & Failures for terminal states.