Skip to main content

services

The compute client module contains the main classes to interact with the Arraylake compute service. For asynchronous operations, the AsyncComputeClient class is recommended, while the ComputeClient class should be used for synchronous operations.

Example usage:

from arraylake import Client
services = Client().get_services("my-org")
services.list_enabled()

AsyncComputeClient​

Asyncio Client for interacting with the Arraylake Compute API for a specific organization.

__init__​

def __init__(service_uri: str, token: str | None, org: str)

Initializes the AsyncComputeClient with the service URI, API token, and organization.

Arguments:

service_uri: The service URI to target. token: API token for service account authentication. org: The organization to target.

enable​

async def enable(protocol: str,
is_public: bool = False,
*,
sku_code: str,
**kwargs) -> dict[str, Any]

Enables a new Arraylake compute service.

list_enabled​

async def list_enabled() -> list[DeploymentInfo]

Lists all of the Arraylake compute services for the organization.

get_status​

async def get_status(service_id: str) -> dict[str, Any]

Gets the status of an Arraylake compute service.

stream_logs​

async def stream_logs(service_id: str,
*,
tail: int | None = None,
follow: bool = False,
since: datetime | None = None,
until: datetime | None = None,
follow_timeout: int = 30) -> AsyncGenerator[str, None]

Streams the logs of an Arraylake compute service.

get_logs​

async def get_logs(service_id: str,
*,
tail: int | None = None,
since: datetime | None = None,
until: datetime | None = None) -> str

Gets a snapshot of the logs of an Arraylake compute service.

update​

async def update(service_id: str,
*,
sku_code: str | None = None,
min_replicas: int | None = None,
max_replicas: int | None = None) -> DeploymentInfo

Changes a running Arraylake compute service's shape or scaling.

Only the provided fields are changed; omitted fields keep their current values.

disable​

async def disable(service_id: str) -> dict[str, Any]

Disables an Arraylake compute service.

ComputeClient​

Synchronous interface for interacting with the Arraylake Compute API.

__init__​

def __init__(aclient: AsyncComputeClient)

Initializes the ComputeClient with an existing AsyncComputeClient instance.

Arguments:

  • aclient - An existing AsyncComputeClient instance.

enable​

def enable(protocol: str,
is_public: bool = False,
*,
sku_code: str,
**kwargs) -> dict[str, Any]

Enables a new Arraylake compute service.

Arguments:

  • protocol - The protocol to use. Must be one of dap2, edr, wms, tiles, zarr, openeo, or sql.
  • is_public - Whether the service should be public or not. Defaults to False.
  • sku_code - The compute shape to run the service on. Every service runs on a priced shape, so this is required.
  • **kwargs - Additional arguments to pass to the service.

Returns:

Confirmation of the service being enabled.

list_enabled​

def list_enabled() -> list[DeploymentInfo]

Lists all of the Arraylake compute services for the organization.

Returns:

The list of services in the organization.

get_status​

def get_status(service_id: str) -> dict[str, Any]

Gets the status of an Arraylake compute service.

Arguments:

  • org - The organization where the service is located.
  • service_id - The ID of the service to get status for.

Returns:

Dictionary containing the status of the service.

get_logs​

def get_logs(service_id: str,
*,
tail: int | None = None,
since: datetime | None = None,
until: datetime | None = None) -> str

Gets a snapshot of the logs of an Arraylake compute service.

Arguments:

  • service_id - The ID of the service to get logs for.
  • tail - The number of lines to fetch from the end of the log.
  • since - The start time of the log window.
  • until - The end time of the log window.

Returns:

The kubernetes logs for the service.

update​

def update(service_id: str,
*,
sku_code: str | None = None,
min_replicas: int | None = None,
max_replicas: int | None = None) -> DeploymentInfo

Changes a running Arraylake compute service's shape or scaling.

Only the provided fields are changed; omitted fields keep their current values.

Arguments:

  • service_id - The ID of the service to update.
  • sku_code - The compute shape (SKU code) to resize the service to.
  • min_replicas - The minimum number of replicas the service scales down to.
  • max_replicas - The maximum number of replicas the service scales up to.

Returns:

The deployment info reflecting the accepted configuration.

disable​

def disable(service_id: str) -> dict[str, Any]

Disables an Arraylake compute service..

Arguments:

  • service_id - The ID of the service to disable.

Returns:

Confirmation of the service being disabled.