prefect.cli.work_pool

Command line interface for working with work queues.

Functions

set_work_pool_as_default

set_work_pool_as_default(name: str) -> None

has_provisioner_for_type

has_provisioner_for_type(work_pool_type: str) -> bool
Check if there is a provisioner for the given work pool type. Args:
  • work_pool_type: The type of the work pool.
Returns:
  • True if a provisioner exists for the given type, False otherwise.

create

create(name: str = typer.Argument(..., help='The name of the work pool.'), base_job_template: typer.FileText = typer.Option(None, '--base-job-template', help='The path to a JSON file containing the base job template to use. If unspecified, Prefect will use the default base job template for the given worker type.'), paused: bool = typer.Option(False, '--paused', help='Whether or not to create the work pool in a paused state.'), type: str = typer.Option(None, '-t', '--type', help='The type of work pool to create.'), set_as_default: bool = typer.Option(False, '--set-as-default', help='Whether or not to use the created work pool as the local default for deployment.'), provision_infrastructure: bool = typer.Option(False, '--provision-infrastructure', '--provision-infra', help='Whether or not to provision infrastructure for the work pool if supported for the given work pool type.'), overwrite: bool = typer.Option(False, '--overwrite', help='Whether or not to overwrite an existing work pool with the same name.'))
Create a new work pool or update an existing one.  Examples:  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

ls(verbose: bool = typer.Option(False, '--verbose', '-v', help='Show additional information about work pools.'))
List work pools.  Examples: $ prefect work-pool ls

inspect

inspect(name: str = typer.Argument(..., help='The name of the work pool to inspect.'), output: Optional[str] = typer.Option(None, '--output', '-o', help='Specify an output format. Currently supports: json'))
Inspect a work pool.  Examples: prefectworkpoolinspect"mypool"prefect work-pool inspect "my-pool" prefect work-pool inspect “my-pool” —output json

pause

pause(name: str = typer.Argument(..., help='The name of the work pool to pause.'))
Pause a work pool.  Examples: $ prefect work-pool pause “my-pool”

resume

resume(name: str = typer.Argument(..., help='The name of the work pool to resume.'))
Resume a work pool.  Examples: $ prefect work-pool resume “my-pool”

update

update(name: str = typer.Argument(..., help='The name of the work pool to update.'), base_job_template: typer.FileText = typer.Option(None, '--base-job-template', help='The path to a JSON file containing the base job template to use. If unspecified, Prefect will use the default base job template for the given worker type. If None, the base job template will not be modified.'), concurrency_limit: int = typer.Option(None, '--concurrency-limit', help='The concurrency limit for the work pool. If None, the concurrency limit will not be modified.'), description: str = typer.Option(None, '--description', help='The description for the work pool. If None, the description will not be modified.'))
Update a work pool.  Examples: $ prefect work-pool update “my-pool”

provision_infrastructure

provision_infrastructure(name: str = typer.Argument(..., help='The name of the work pool to provision infrastructure for.'))
Provision infrastructure for a work pool.  Examples: $ prefect work-pool provision-infrastructure “my-pool” $ prefect work-pool provision-infra “my-pool”

delete

delete(name: str = typer.Argument(..., help='The name of the work pool to delete.'))
Delete a work pool.  Examples: $ prefect work-pool delete “my-pool”

set_concurrency_limit

set_concurrency_limit(name: str = typer.Argument(..., help='The name of the work pool to update.'), concurrency_limit: int = typer.Argument(..., help='The new concurrency limit for the work pool.'))
Set the concurrency limit for a work pool.  Examples: $ prefect work-pool set-concurrency-limit “my-pool” 10

clear_concurrency_limit

clear_concurrency_limit(name: str = typer.Argument(..., help='The name of the work pool to update.'))
Clear the concurrency limit for a work pool.  Examples: $ prefect work-pool clear-concurrency-limit “my-pool”

get_default_base_job_template

get_default_base_job_template(type: str = typer.Option(None, '-t', '--type', help='The type of work pool for which to get the default base job template.'), file: str = typer.Option(None, '-f', '--file', help='If set, write the output to a file.'))
Get the default base job template for a given work pool type.  Examples: $ prefect work-pool get-default-base-job-template —type kubernetes

preview

preview(name: str = typer.Argument(None, help='The name or ID of the work pool to preview'), hours: int = typer.Option(None, '-h', '--hours', help='The number of hours to look ahead; defaults to 1 hour'))
Preview the work pool’s scheduled work for all queues.  Examples: $ prefect work-pool preview “my-pool” —hours 24

storage_inspect

storage_inspect(work_pool_name: Annotated[str, typer.Argument(..., help='The name of the work pool to display storage configuration for.')], output: Optional[str] = typer.Option(None, '--output', '-o', help='Specify an output format. Currently supports: json'))
EXPERIMENTAL: Inspect the storage configuration for a work pool. Examples: prefectworkpoolstorageinspect"mypool"prefect work-pool storage inspect "my-pool" prefect work-pool storage inspect “my-pool” —output json

s3

s3(work_pool_name: str = typer.Argument(..., help='The name of the work pool to configure storage for.', show_default=False), bucket: str = typer.Option(..., '--bucket', help='The name of the S3 bucket to use.', show_default=False, prompt='Enter the name of the S3 bucket to use'), credentials_block_name: str = typer.Option(..., '--aws-credentials-block-name', help='The name of the AWS credentials block to use.', show_default=False, prompt='Enter the name of the AWS credentials block to use'))
EXPERIMENTAL: Configure AWS S3 storage for a work pool.  Examples: $ prefect work-pool storage configure s3 “my-pool” —bucket my-bucket —aws-credentials-block-name my-credentials

gcs

gcs(work_pool_name: str = typer.Argument(..., help='The name of the work pool to configure storage for.', show_default=False), bucket: str = typer.Option(..., '--bucket', help='The name of the Google Cloud Storage bucket to use.', show_default=False, prompt='Enter the name of the Google Cloud Storage bucket to use'), credentials_block_name: str = typer.Option(..., '--gcp-credentials-block-name', help='The name of the Google Cloud credentials block to use.', show_default=False, prompt='Enter the name of the Google Cloud credentials block to use'))
EXPERIMENTAL: Configure Google Cloud storage for a work pool.  Examples: $ prefect work-pool storage configure gcs “my-pool” —bucket my-bucket —gcp-credentials-block-name my-credentials

azure_blob_storage

azure_blob_storage(work_pool_name: str = typer.Argument(..., help='The name of the work pool to configure storage for.', show_default=False), container: str = typer.Option(..., '--container', help='The name of the Azure Blob Storage container to use.', show_default=False, prompt='Enter the name of the Azure Blob Storage container to use'), credentials_block_name: str = typer.Option(..., '--azure-blob-storage-credentials-block-name', help='The name of the Azure Blob Storage credentials block to use.', show_default=False, prompt='Enter the name of the Azure Blob Storage credentials block to use'))
EXPERIMENTAL: Configure Azure Blob Storage for a work pool.  Examples: $ prefect work-pool storage configure azure-blob-storage “my-pool” —container my-container —azure-blob-storage-credentials-block-name my-credentials