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:

FieldUnit or meaning
cpu_core_secondsCPU core-seconds
memory_gib_secondsGiB-seconds of memory
memory_peak_bytesPeak observed memory in bytes
memory_average_bytesAverage observed memory in bytes
duration_secondsExecution duration in seconds
gpu_typeGPU type when applicable
gpu_secondsGPU seconds when applicable

Read the projection after awaiting the result or a terminal status:

python
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.