Workspace#

class polars_cloud.Workspace(
name: str | None = None,
*,
id: UUID | None = None,
organization: str | UUID | Organization | None = None,
)

Polars Workspace.

Parameters:
name

Name of the workspace.

id

Workspace identifier.

Attributes:

id

Workspace id.

name

Workspace name.

status

Workspace status.

organization

Workspace status.

defaults

Default Cluster Specification.

Methods:

load

Load the workspace details (e.g. name, status, id) from the control plane.

is_active

Whether the Workspace is active.

verify

Verify that a workspace was created correctly.

delete

Delete a workspace.

setup

Create a new workspace.

list

List all workspaces the user has access to.

property id: UUID

Workspace id.

property name: str

Workspace name.

property status: WorkspaceStatus

Workspace status.

property organization: Organization

Workspace status.

property defaults: WorkspaceDefaultComputeSpecs | None

Default Cluster Specification.

load() None

Load the workspace details (e.g. name, status, id) from the control plane.

Note

Depending on the input load will load the Workspace object by id / name or if neither is given it will attempt to get the users default workspace.

is_active() bool

Whether the Workspace is active.

Examples

>>> pc.Workspace("workspace-name").is_active()
True
verify(*, interval: int = 2, timeout: int = 300) bool

Verify that a workspace was created correctly.

Parameters:
interval

The number of seconds between each verification call.

timeout

The number of seconds before verification fails.

Examples

>>> pc.Workspace("workspace-name").verify(timeout=5)
True
delete() None

Delete a workspace.

Examples

>>> pc.Workspace("workspace-name").delete()
Are you sure you want to delete the workspace? (y/n)
classmethod setup(
workspace_name: str,
organization_name: str,
*,
verify: bool = True,
) Self

Create a new workspace.

Parameters:
workspace_name

Desired name of the workspace

organization_name

Name of the organization

verify

Wait for workspace to become active

Examples

>>> pc.Workspace.setup(
...     "new-workspace-name", organization_name="organization-name"
... )
Please complete the workspace setup process in your browser.
Workspace creation may take up to 5 minutes to complete after clicking
'Create stack'. If your browser did not open automatically,
please go to the following URL:
[URL]
classmethod list(
name: str | None = None,
) list[Workspace]

List all workspaces the user has access to.

Parameters:
name

Filter workspaces by name prefix.

Examples

>>> pc.Workspace.list()
[Workspace(id=UUID('xxxxxxxx-xxxx-7810-ad2d-0a642bccf80e'),
    name='new-workspace', status=Uninitialized, defaults=None),
    Workspace(id=UUID('xxxxxxxx-xxxx-7e02-9a2c-5ab4a8ed8937'),
    name='workspace-name',status=Active, defaults=None),]
>>> pc.Workspace.list(name="new")
[Workspace(id=UUID('xxxxxxxx-xxxx-7810-ad2d-0a642bccf80e'),
    name='new-workspace', status=Uninitialized, defaults=None)]