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.

aws

The AWS connection of the workspace.

Methods:

load

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

is_active

Whether the Workspace is active.

wait_until_active

Wait until the workspace becomes active.

delete

Delete a workspace.

create

Create a new workspace.

setup

Create a new workspace and connect it to AWS.

connect_provider

Connect an infrastructure provider to the workspace.

deploy

Connect an existing workspace to your own cloud environment.

list

List all workspaces the user has access to.

property id: UUID

Workspace id.

property name: str

Workspace name.

property status: WorkspaceStatus

Workspace status.

Deprecated since version 0.11.0: Workspace status and deployment have been deprecated and will be removed in future versions to support multiple infrastructure providers. Use .aws.is_connected() to check whether AWS is connected.

property organization: Organization

Workspace status.

property defaults: WorkspaceDefaultComputeSpecs | None

Default Cluster Specification.

property aws: WorkspaceProviderAWS

The AWS connection of the workspace.

Examples

>>> pc.Workspace("workspace-name").aws.is_connected()
True
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.

Deprecated since version 0.11.0: Workspace status and deployment have been deprecated and will be removed in future versions to support multiple infrastructure providers. Use .aws.is_connected() to check whether AWS is connected.

Examples

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

Wait until the workspace becomes active.

Deprecated since version 0.11.0: Workspace status and deployment have been deprecated and will be removed in future versions to support multiple infrastructure providers. Use .aws.is_connected() to check whether AWS is connected.

Parameters:
interval

The number of seconds between each verification call.

timeout

The number of seconds before verification fails.

Examples

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

Delete a workspace.

The workspace must not have any infrastructure attached to it. Disconnect its infrastructure provider first, for example with .aws.disconnect.

Examples

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

Create a new workspace.

The workspace is created without any infrastructure attached to it. Use deploy() to connect it to your own cloud environment.

Parameters:
workspace_name

Desired name of the workspace.

organization_name

Name of the organization to create the workspace in. The organization must already exist.

Examples

>>> pc.Workspace.create("new-workspace-name", "organization-name")
Workspace(id=UUID('xxxxxxxx-xxxx-7fd0-899b-5aaeefa553d1'),
    name='new-workspace-name'
classmethod setup(
workspace_name: str,
organization_name: str,
*,
verify: bool = True,
) Self

Create a new workspace and connect it to AWS.

Deprecated since version 0.11.0: Workspace setup has been deprecated and will be removed in future versions. Use Workspace.create to create the workspace, followed by .connect_provider() to connect it to your infrastructure.

See also

create, connect_provider
connect_provider(
provider: ProviderType = AWS,
*,
verify: bool = True,
) None

Connect an infrastructure provider to the workspace.

The workspace runs its compute on the connected provider. For AWS this opens a CloudFormation setup flow in a browser.

Does nothing if the provider is already connected.

Parameters:
provider

The infrastructure to run the workspace compute on.

verify

Wait for the provider to be connected.

Examples

>>> pc.Workspace("workspace-name").connect_provider()
Please complete the workspace setup process in your browser.
Connecting your infrastructure 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]
deploy(
*,
provider_type: ProviderType = AWS,
verify: bool = True,
) None

Connect an existing workspace to your own cloud environment.

Deprecated since version 0.11.0: Workspace deploy has been deprecated and will be removed in future versions. Use Workspace.connect_provider to connect your provider

Parameters:
provider_type

The infrastructure to run the workspace compute on.

verify

Wait for the deployment to complete

Examples

>>> pc.Workspace("workspace-name").deploy()
Please complete the workspace setup process in your browser.
Connecting your infrastructure 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', defaults=None),
    Workspace(id=UUID('xxxxxxxx-xxxx-7e02-9a2c-5ab4a8ed8937'),
    name='workspace-name', defaults=None),]
>>> pc.Workspace.list(name="new")
[Workspace(id=UUID('xxxxxxxx-xxxx-7810-ad2d-0a642bccf80e'),
    name='new-workspace', defaults=None)]