1. Packages
  2. Prefect Provider
  3. API Docs
  4. WorkPool
prefect 2.24.1 published on Tuesday, Apr 15, 2025 by prefecthq

prefect.WorkPool

Explore with Pulumi AI

The resource work_pool represents a Prefect Work Pool. Work Pools represent infrastructure configurations for jobs across several common environments.

Work Pools can be set up with default base job configurations, based on which type. Use this in conjunction with the prefect.getWorkerMetadata data source to bootstrap new Work Pools quickly.

For more information, see configure dynamic infrastructure with work pools.

This feature is available in the following product plan(s): Prefect OSS, Prefect Cloud (Free), Prefect Cloud (Pro), Prefect Cloud (Enterprise).

Create WorkPool Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new WorkPool(name: string, args?: WorkPoolArgs, opts?: CustomResourceOptions);
@overload
def WorkPool(resource_name: str,
             args: Optional[WorkPoolArgs] = None,
             opts: Optional[ResourceOptions] = None)

@overload
def WorkPool(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             account_id: Optional[str] = None,
             base_job_template: Optional[str] = None,
             concurrency_limit: Optional[float] = None,
             description: Optional[str] = None,
             name: Optional[str] = None,
             paused: Optional[bool] = None,
             type: Optional[str] = None,
             workspace_id: Optional[str] = None)
func NewWorkPool(ctx *Context, name string, args *WorkPoolArgs, opts ...ResourceOption) (*WorkPool, error)
public WorkPool(string name, WorkPoolArgs? args = null, CustomResourceOptions? opts = null)
public WorkPool(String name, WorkPoolArgs args)
public WorkPool(String name, WorkPoolArgs args, CustomResourceOptions options)
type: prefect:WorkPool
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args WorkPoolArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args WorkPoolArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args WorkPoolArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args WorkPoolArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkPoolArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var workPoolResource = new Prefect.WorkPool("workPoolResource", new()
{
    AccountId = "string",
    BaseJobTemplate = "string",
    ConcurrencyLimit = 0,
    Description = "string",
    Name = "string",
    Paused = false,
    Type = "string",
    WorkspaceId = "string",
});
Copy
example, err := prefect.NewWorkPool(ctx, "workPoolResource", &prefect.WorkPoolArgs{
AccountId: pulumi.String("string"),
BaseJobTemplate: pulumi.String("string"),
ConcurrencyLimit: pulumi.Float64(0),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
Paused: pulumi.Bool(false),
Type: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
Copy
var workPoolResource = new WorkPool("workPoolResource", WorkPoolArgs.builder()
    .accountId("string")
    .baseJobTemplate("string")
    .concurrencyLimit(0)
    .description("string")
    .name("string")
    .paused(false)
    .type("string")
    .workspaceId("string")
    .build());
Copy
work_pool_resource = prefect.WorkPool("workPoolResource",
    account_id="string",
    base_job_template="string",
    concurrency_limit=0,
    description="string",
    name="string",
    paused=False,
    type="string",
    workspace_id="string")
Copy
const workPoolResource = new prefect.WorkPool("workPoolResource", {
    accountId: "string",
    baseJobTemplate: "string",
    concurrencyLimit: 0,
    description: "string",
    name: "string",
    paused: false,
    type: "string",
    workspaceId: "string",
});
Copy
type: prefect:WorkPool
properties:
    accountId: string
    baseJobTemplate: string
    concurrencyLimit: 0
    description: string
    name: string
    paused: false
    type: string
    workspaceId: string
Copy

WorkPool Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The WorkPool resource accepts the following input properties:

AccountId string
Account ID (UUID), defaults to the account set in the provider
BaseJobTemplate string
The base job template for the work pool, as a JSON string
ConcurrencyLimit double
The concurrency limit applied to this work pool
Description string
Description of the work pool
Name string
Name of the work pool
Paused bool
Whether this work pool is paused
Type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
AccountId string
Account ID (UUID), defaults to the account set in the provider
BaseJobTemplate string
The base job template for the work pool, as a JSON string
ConcurrencyLimit float64
The concurrency limit applied to this work pool
Description string
Description of the work pool
Name string
Name of the work pool
Paused bool
Whether this work pool is paused
Type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate String
The base job template for the work pool, as a JSON string
concurrencyLimit Double
The concurrency limit applied to this work pool
description String
Description of the work pool
name String
Name of the work pool
paused Boolean
Whether this work pool is paused
type String
Type of the work pool, eg. kubernetes, ecs, process, etc.
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId string
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate string
The base job template for the work pool, as a JSON string
concurrencyLimit number
The concurrency limit applied to this work pool
description string
Description of the work pool
name string
Name of the work pool
paused boolean
Whether this work pool is paused
type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
workspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
account_id str
Account ID (UUID), defaults to the account set in the provider
base_job_template str
The base job template for the work pool, as a JSON string
concurrency_limit float
The concurrency limit applied to this work pool
description str
Description of the work pool
name str
Name of the work pool
paused bool
Whether this work pool is paused
type str
Type of the work pool, eg. kubernetes, ecs, process, etc.
workspace_id str
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate String
The base job template for the work pool, as a JSON string
concurrencyLimit Number
The concurrency limit applied to this work pool
description String
Description of the work pool
name String
Name of the work pool
paused Boolean
Whether this work pool is paused
type String
Type of the work pool, eg. kubernetes, ecs, process, etc.
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkPool resource produces the following output properties:

Created string
Timestamp of when the resource was created (RFC3339)
DefaultQueueId string
The ID (UUID) of the default queue associated with this work pool
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
Created string
Timestamp of when the resource was created (RFC3339)
DefaultQueueId string
The ID (UUID) of the default queue associated with this work pool
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
defaultQueueId String
The ID (UUID) of the default queue associated with this work pool
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)
created string
Timestamp of when the resource was created (RFC3339)
defaultQueueId string
The ID (UUID) of the default queue associated with this work pool
id string
The provider-assigned unique ID for this managed resource.
updated string
Timestamp of when the resource was updated (RFC3339)
created str
Timestamp of when the resource was created (RFC3339)
default_queue_id str
The ID (UUID) of the default queue associated with this work pool
id str
The provider-assigned unique ID for this managed resource.
updated str
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
defaultQueueId String
The ID (UUID) of the default queue associated with this work pool
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)

Look up Existing WorkPool Resource

Get an existing WorkPool resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: WorkPoolState, opts?: CustomResourceOptions): WorkPool
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        base_job_template: Optional[str] = None,
        concurrency_limit: Optional[float] = None,
        created: Optional[str] = None,
        default_queue_id: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        paused: Optional[bool] = None,
        type: Optional[str] = None,
        updated: Optional[str] = None,
        workspace_id: Optional[str] = None) -> WorkPool
func GetWorkPool(ctx *Context, name string, id IDInput, state *WorkPoolState, opts ...ResourceOption) (*WorkPool, error)
public static WorkPool Get(string name, Input<string> id, WorkPoolState? state, CustomResourceOptions? opts = null)
public static WorkPool get(String name, Output<String> id, WorkPoolState state, CustomResourceOptions options)
resources:  _:    type: prefect:WorkPool    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
Account ID (UUID), defaults to the account set in the provider
BaseJobTemplate string
The base job template for the work pool, as a JSON string
ConcurrencyLimit double
The concurrency limit applied to this work pool
Created string
Timestamp of when the resource was created (RFC3339)
DefaultQueueId string
The ID (UUID) of the default queue associated with this work pool
Description string
Description of the work pool
Name string
Name of the work pool
Paused bool
Whether this work pool is paused
Type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
AccountId string
Account ID (UUID), defaults to the account set in the provider
BaseJobTemplate string
The base job template for the work pool, as a JSON string
ConcurrencyLimit float64
The concurrency limit applied to this work pool
Created string
Timestamp of when the resource was created (RFC3339)
DefaultQueueId string
The ID (UUID) of the default queue associated with this work pool
Description string
Description of the work pool
Name string
Name of the work pool
Paused bool
Whether this work pool is paused
Type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate String
The base job template for the work pool, as a JSON string
concurrencyLimit Double
The concurrency limit applied to this work pool
created String
Timestamp of when the resource was created (RFC3339)
defaultQueueId String
The ID (UUID) of the default queue associated with this work pool
description String
Description of the work pool
name String
Name of the work pool
paused Boolean
Whether this work pool is paused
type String
Type of the work pool, eg. kubernetes, ecs, process, etc.
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId string
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate string
The base job template for the work pool, as a JSON string
concurrencyLimit number
The concurrency limit applied to this work pool
created string
Timestamp of when the resource was created (RFC3339)
defaultQueueId string
The ID (UUID) of the default queue associated with this work pool
description string
Description of the work pool
name string
Name of the work pool
paused boolean
Whether this work pool is paused
type string
Type of the work pool, eg. kubernetes, ecs, process, etc.
updated string
Timestamp of when the resource was updated (RFC3339)
workspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
account_id str
Account ID (UUID), defaults to the account set in the provider
base_job_template str
The base job template for the work pool, as a JSON string
concurrency_limit float
The concurrency limit applied to this work pool
created str
Timestamp of when the resource was created (RFC3339)
default_queue_id str
The ID (UUID) of the default queue associated with this work pool
description str
Description of the work pool
name str
Name of the work pool
paused bool
Whether this work pool is paused
type str
Type of the work pool, eg. kubernetes, ecs, process, etc.
updated str
Timestamp of when the resource was updated (RFC3339)
workspace_id str
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID), defaults to the account set in the provider
baseJobTemplate String
The base job template for the work pool, as a JSON string
concurrencyLimit Number
The concurrency limit applied to this work pool
created String
Timestamp of when the resource was created (RFC3339)
defaultQueueId String
The ID (UUID) of the default queue associated with this work pool
description String
Description of the work pool
name String
Name of the work pool
paused Boolean
Whether this work pool is paused
type String
Type of the work pool, eg. kubernetes, ecs, process, etc.
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider. In Prefect Cloud, either the work_pool resource or the provider's workspace_id must be set.

Import

Prefect Work Pools can be imported using the name

$ pulumi import prefect:index/workPool:WorkPool example kubernetes-work-pool
Copy

or from a different workspace via name,workspace_id

$ pulumi import prefect:index/workPool:WorkPool example kubernetes-work-pool,00000000-0000-0000-0000-000000000000
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
prefect prefecthq/terraform-provider-prefect
License
Notes
This Pulumi package is based on the prefect Terraform Provider.