Back to Prefect

work_pool

docs/v3/api-ref/python/prefect-cli-work_pool.mdx

3.8.08.1 KB
Original Source

prefect.cli.work_pool

Work pool command — native cyclopts implementation.

Manage work pools.

Functions

create <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L297" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
create(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool.')])

Create a new work pool or update an existing one.

Examples:

bash
# Create a Kubernetes work pool in a paused state
$ prefect work-pool create "my-pool" --type kubernetes --paused

# Create a Docker work pool with a custom base job template
$ prefect work-pool create "my-pool" --type docker --base-job-template ./base-job-template.json

# Update an existing work pool
$ prefect work-pool create "existing-pool" --base-job-template ./base-job-template.json --overwrite

ls <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L518" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
ls()

List work pools.

Examples:

bash
$ prefect work-pool ls

inspect <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L603" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
inspect(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to inspect.')])

Inspect a work pool.

Examples:

bash
$ prefect work-pool inspect "my-pool"
$ prefect work-pool inspect "my-pool" --output json

slots <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L648" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
slots(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool.')])

Show concurrency slot utilization for a work pool.

pause <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L757" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
pause(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to pause.')])

Pause a work pool.

Examples:

bash
$ prefect work-pool pause "my-pool"

resume <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L787" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
resume(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to resume.')])

Resume a work pool.

Examples:

bash
$ prefect work-pool resume "my-pool"

update <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L817" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
update(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to update.')])

Update a work pool.

Examples:

bash
$ prefect work-pool update "my-pool"

provision_infrastructure_cmd <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L887" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
provision_infrastructure_cmd(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to provision infrastructure for.')])

Provision infrastructure for a work pool.

Examples:

bash
$ prefect work-pool provision-infrastructure "my-pool"
$ prefect work-pool provision-infra "my-pool"

delete <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L960" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
delete(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to delete.')])

Delete a work pool.

Examples:

bash
$ prefect work-pool delete "my-pool"

set_concurrency_limit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L994" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
set_concurrency_limit(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to update.')], concurrency_limit: Annotated[int, cyclopts.Parameter(help='The new concurrency limit for the work pool.')])

Set the concurrency limit for a work pool.

Examples:

bash
$ prefect work-pool set-concurrency-limit "my-pool" 10

clear_concurrency_limit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1029" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
clear_concurrency_limit(name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to update.')])

Clear the concurrency limit for a work pool.

Examples:

bash
$ prefect work-pool clear-concurrency-limit "my-pool"

get_default_base_job_template <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1059" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_default_base_job_template()

Get the default base job template for a given work pool type.

Examples:

bash
$ prefect work-pool get-default-base-job-template --type kubernetes

preview <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
preview(name: Annotated[Optional[str], cyclopts.Parameter(help='The name or ID of the work pool to preview')] = None)

Preview the work pool's scheduled work for all queues.

Examples:

bash
$ prefect work-pool preview "my-pool" --hours 24

storage_inspect <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1240" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
storage_inspect(work_pool_name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to display storage configuration for.')])

EXPERIMENTAL: Inspect the storage configuration for a work pool.

Examples:

bash
$ prefect work-pool storage inspect "my-pool"
$ prefect work-pool storage inspect "my-pool" --output json

storage_configure_s3 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1397" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
storage_configure_s3(work_pool_name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to configure storage for.')])

EXPERIMENTAL: Configure AWS S3 storage for a work pool.

Examples:

bash
$ prefect work-pool storage configure s3 "my-pool" --bucket my-bucket --aws-credentials-block-name my-credentials

storage_configure_gcs <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1539" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
storage_configure_gcs(work_pool_name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to configure storage for.')])

EXPERIMENTAL: Configure Google Cloud storage for a work pool.

Examples:

bash
$ prefect work-pool storage configure gcs "my-pool" --bucket my-bucket --gcp-credentials-block-name my-credentials

storage_configure_azure_blob_storage <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/work_pool.py#L1687" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
storage_configure_azure_blob_storage(work_pool_name: Annotated[str, cyclopts.Parameter(help='The name of the work pool to configure storage for.')])

EXPERIMENTAL: Configure Azure Blob Storage for a work pool.

Examples:

bash
$ prefect work-pool storage configure azure-blob-storage "my-pool" --container my-container --azure-blob-storage-credentials-block-name my-credentials