K8s Cluster

class lightning_sdk.k8s_cluster.K8sCluster(cloud_account)

Bases: object

Interact with a Kubernetes cluster to retrieve GPU billing usage.

Connect to a Kubernetes cluster by cloud account.

Parameters:
  • cloud_account (str) – The cloud account ID associated with the cluster.

  • cloud_account (str)

get_billing_usage(start_date=None, end_date=None, print_data=False)

Retrieve GPU billing usage for this cluster.

Parameters:
  • start_date (Optional[datetime]) – UTC start of the query window. Defaults to None (no lower bound).

  • end_date (Optional[datetime]) – UTC end of the query window. Defaults to None (no upper bound).

  • print_data (bool) – Whether to print the raw usage data to stdout. Defaults to False.

  • start_date (datetime | None)

  • end_date (datetime | None)

  • print_data (bool)

Returns:

Hourly GPU usage breakdown and the total billed GPU count.

Return type:

K8sUsageResponse

class lightning_sdk.k8s_cluster.K8sUsageResponse(hours, total_usage)

Bases: object

Aggregated GPU billing response for a queried time range.

Parameters:
hours

Per-hour breakdown of GPU usage.

total_usage

Sum of billed GPUs across all hours.

class lightning_sdk.k8s_cluster.HourlyUsage(time, available_gpus, billed_gpus)

Bases: object

GPU billing data for a single one-hour window.

Parameters:
time

Start of the hour (UTC).

available_gpus

Total GPUs allocated during this hour.

billed_gpus

GPUs that were actively billed during this hour.

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close