silverback.cluster

The silverback.cluster module contains several submodules intended to work directly with hosted (and local) Silverback Clusters, and assist in integration with the Silverback Platform.

class silverback.cluster.client.Bot(*, id: UUID, name: str, created: datetime, image: str, credential_name: str | None, ecosystem: str, network: str, provider: str, account: str | None, environment: list[str])

Bases: BotInfo

class silverback.cluster.client.ClusterClient(*args, **kwargs)

Bases: Client

send(request, *args, **kwargs)

Send a request.

The request is sent as-is, unmodified.

Typically you’ll want to build one with Client.build_request() so that any client-level configuration is merged into the request, but passing an explicit httpx.Request() is supported as well.

See also: [Request instances][0]

[0]: /advanced/clients/#request-instances

class silverback.cluster.client.PlatformClient(*args, **kwargs)

Bases: Client

send(request, *args, **kwargs)

Send a request.

The request is sent as-is, unmodified.

Typically you’ll want to build one with Client.build_request() so that any client-level configuration is merged into the request, but passing an explicit httpx.Request() is supported as well.

See also: [Request instances][0]

[0]: /advanced/clients/#request-instances

class silverback.cluster.client.RegistryCredentials(*, id: str, name: str, hostname: str, created: datetime, updated: datetime)

Bases: RegistryCredentialsInfo

class silverback.cluster.client.VariableGroup(*, id: UUID, name: str, variables: list[str], created: datetime)

Bases: VariableGroupInfo

class silverback.cluster.client.Workspace(*, id: UUID, owner_id: UUID, name: str, slug: str, created: datetime)

Bases: WorkspaceInfo

class silverback.cluster.settings.AuthenticationConfig(*, host: str = 'https://account.apeworx.io', client_id: str = 'lcylrp34lnggGO-E-KKlMJgvAI4Q2Jhf6U2G6CB5uMg')

Bases: BaseModel

Authentication host configuration information (~/.silverback/profile.toml)

class silverback.cluster.settings.BaseProfile(*, host: str)

Bases: BaseModel

Profile information (~/.silverback/profile.toml)

class silverback.cluster.settings.ClusterProfile(*, host: str, api_key: str)

Bases: BaseProfile

class silverback.cluster.settings.PlatformProfile(*, host: str, auth: str, default_workspace: str = '', default_cluster: dict[str, str] = <factory>)

Bases: BaseProfile

class silverback.cluster.settings.ProfileSettings(*, auth: dict[str, AuthenticationConfig], profile: dict[str, PlatformProfile | ClusterProfile], default_profile: str = 'default')

Bases: BaseModel

Configuration settings for working with Bot Clusters and the Silverback Platform

class silverback.cluster.types.BotInfo(*, id: UUID, name: str, created: datetime, image: str, credential_name: str | None, ecosystem: str, network: str, provider: str, account: str | None, environment: list[str])

Bases: BaseModel

class silverback.cluster.types.BotLogEntry(*, level: LogLevel | None = None, timestamp: datetime | None = None, message: str)

Bases: BaseModel

class silverback.cluster.types.BotTaskStatus(*, last_status: str, exit_code: int | None, reason: str | None, started_at: datetime | None, stop_code: str | None, stopped_at: datetime | None, stopped_reason: str | None)

Bases: BaseModel

class silverback.cluster.types.ClusterConfiguration(*, version: int = 1, cpu: Annotated[int, Ge(ge=1), Le(le=64)] = 1, memory: Annotated[int, Ge(ge=1), Le(le=128)] = 1, networks: Annotated[int, Ge(ge=1), Le(le=20)] = 1, bots: Annotated[int, Ge(ge=1), Le(le=250)] = 1, bandwidth: Annotated[int, Ge(ge=1), Le(le=250)] = 1, duration: Annotated[int, Ge(ge=1), Le(le=120)] = 1)

Bases: BaseModel

Configuration of the cluster (represented as 16 byte value)

bandwidth: Annotated[int, Field(ge=1, le=250)]

Rate at which data should be emitted by cluster (in KiB/sec)

bots: Annotated[int, Field(ge=1, le=250)]

Maximum number of guaranteed concurrently running bots

cpu: Annotated[int, Field(ge=1, le=64)]

Max vCPUs shared by all bots in cluster

classmethod decode(value: Any) ClusterConfiguration

Decode the configuration from 8 byte integer value

duration: Annotated[int, Field(ge=1, le=120)]

Time to keep data recording duration (in months)

encode() int

Encode configuration as 8 byte integer value

memory: Annotated[int, Field(ge=1, le=128)]

Max memory (in GiB) shared by all bots in cluster

networks: Annotated[int, Field(ge=1, le=20)]

Maximum number of concurrent networks all bots can use

version: int

Version of this configuration (used for encoding/decoding)

class silverback.cluster.types.ClusterHealth(*, networks: dict[str, ~silverback.cluster.types.ServiceHealth] = <factory>, bots: dict[str, ~silverback.cluster.types.ServiceHealth] = <factory>)

Bases: BaseModel

class silverback.cluster.types.ClusterInfo(*, id: UUID, version: str | None, configuration: ClusterConfiguration | None = None, name: str, slug: str, expiration: datetime | None = None, stream_id: UUID | None = None, created: datetime, status: ResourceStatus, last_updated: datetime)

Bases: BaseModel

class silverback.cluster.types.ClusterTier(value)

Bases: IntEnum

Suggestions for different tier configurations

class silverback.cluster.types.RegistryCredentialsInfo(*, id: str, name: str, hostname: str, created: datetime, updated: datetime)

Bases: BaseModel

class silverback.cluster.types.ResourceStatus(value)

Bases: IntEnum

Generic enum that represents that status of any associated resource or service.

`{note} Calling `str(...)` on this will produce a human-readable status for display. `

CREATED = 0

Resource record created, but not provisioning yet (likely awaiting payment)

DEPROVISIONING = 8

User removal action or payment expiration event triggered

PROVISIONING = 2

Resource is provisioning infrastructure (on payment received)

REMOVED = 9

Infrastructure de-provisioning complete (Cannot change from this state)

RUNNING = 4

Resource is in good health (Resource itself should be reporting status now)

SHUTDOWN = 6

Resource is being put into the STOPPED state

STARTUP = 3

Resource is being put into the RUNNING state

STOPPED = 7

Resource has stopped (due to errors, user action, or resource contraints)

class silverback.cluster.types.ServiceHealth(*, healthy: bool)

Bases: BaseModel

class silverback.cluster.types.StreamInfo(*, chain_id: int, manager: Annotated[ChecksumAddress, _AddressValidator], stream_id: int)

Bases: BaseModel

class silverback.cluster.types.VariableGroupInfo(*, id: UUID, name: str, variables: list[str], created: datetime)

Bases: BaseModel

class silverback.cluster.types.WorkspaceInfo(*, id: UUID, owner_id: UUID, name: str, slug: str, created: datetime)

Bases: BaseModel