prefect.getWorkerMetadata
Explore with Pulumi AI
Get metadata information about the common Worker types, such as Kubernetes, ECS, etc.
Use this data source to get the default base job configurations for those common Worker types.
For more information, see workers.
This feature is available in the following product plan(s): Prefect OSS, Prefect Cloud (Free), Prefect Cloud (Pro), Prefect Cloud (Enterprise).
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as prefect from "@pulumi/prefect";
const workerMetadata = prefect.getWorkerMetadata({});
const kubernetes = new prefect.WorkPool("kubernetes", {
type: "kubernetes",
workspaceId: data.prefect_workspace.prd.id,
paused: false,
baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.kubernetes),
});
const ecs = new prefect.WorkPool("ecs", {
type: "ecs",
workspaceId: data.prefect_workspace.prd.id,
paused: false,
baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.ecs),
});
const process = new prefect.WorkPool("process", {
type: "cloud-run:push",
workspaceId: data.prefect_workspace.prd.id,
paused: false,
baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.cloudRunPush),
});
import pulumi
import pulumi_prefect as prefect
worker_metadata = prefect.get_worker_metadata()
kubernetes = prefect.WorkPool("kubernetes",
type="kubernetes",
workspace_id=data["prefect_workspace"]["prd"]["id"],
paused=False,
base_job_template=worker_metadata.base_job_configs.kubernetes)
ecs = prefect.WorkPool("ecs",
type="ecs",
workspace_id=data["prefect_workspace"]["prd"]["id"],
paused=False,
base_job_template=worker_metadata.base_job_configs.ecs)
process = prefect.WorkPool("process",
type="cloud-run:push",
workspace_id=data["prefect_workspace"]["prd"]["id"],
paused=False,
base_job_template=worker_metadata.base_job_configs.cloud_run_push)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/prefect/v2/prefect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
workerMetadata, err := prefect.GetWorkerMetadata(ctx, &prefect.GetWorkerMetadataArgs{}, nil)
if err != nil {
return err
}
_, err = prefect.NewWorkPool(ctx, "kubernetes", &prefect.WorkPoolArgs{
Type: pulumi.String("kubernetes"),
WorkspaceId: pulumi.Any(data.Prefect_workspace.Prd.Id),
Paused: pulumi.Bool(false),
BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.Kubernetes),
})
if err != nil {
return err
}
_, err = prefect.NewWorkPool(ctx, "ecs", &prefect.WorkPoolArgs{
Type: pulumi.String("ecs"),
WorkspaceId: pulumi.Any(data.Prefect_workspace.Prd.Id),
Paused: pulumi.Bool(false),
BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.Ecs),
})
if err != nil {
return err
}
_, err = prefect.NewWorkPool(ctx, "process", &prefect.WorkPoolArgs{
Type: pulumi.String("cloud-run:push"),
WorkspaceId: pulumi.Any(data.Prefect_workspace.Prd.Id),
Paused: pulumi.Bool(false),
BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.CloudRunPush),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Prefect = Pulumi.Prefect;
return await Deployment.RunAsync(() =>
{
var workerMetadata = Prefect.GetWorkerMetadata.Invoke();
var kubernetes = new Prefect.WorkPool("kubernetes", new()
{
Type = "kubernetes",
WorkspaceId = data.Prefect_workspace.Prd.Id,
Paused = false,
BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.Kubernetes),
});
var ecs = new Prefect.WorkPool("ecs", new()
{
Type = "ecs",
WorkspaceId = data.Prefect_workspace.Prd.Id,
Paused = false,
BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.Ecs),
});
var process = new Prefect.WorkPool("process", new()
{
Type = "cloud-run:push",
WorkspaceId = data.Prefect_workspace.Prd.Id,
Paused = false,
BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.CloudRunPush),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.prefect.PrefectFunctions;
import com.pulumi.prefect.inputs.GetWorkerMetadataArgs;
import com.pulumi.prefect.WorkPool;
import com.pulumi.prefect.WorkPoolArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var workerMetadata = PrefectFunctions.getWorkerMetadata();
var kubernetes = new WorkPool("kubernetes", WorkPoolArgs.builder()
.type("kubernetes")
.workspaceId(data.prefect_workspace().prd().id())
.paused(false)
.baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().kubernetes()))
.build());
var ecs = new WorkPool("ecs", WorkPoolArgs.builder()
.type("ecs")
.workspaceId(data.prefect_workspace().prd().id())
.paused(false)
.baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().ecs()))
.build());
var process = new WorkPool("process", WorkPoolArgs.builder()
.type("cloud-run:push")
.workspaceId(data.prefect_workspace().prd().id())
.paused(false)
.baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().cloudRunPush()))
.build());
}
}
resources:
kubernetes:
type: prefect:WorkPool
properties:
type: kubernetes
workspaceId: ${data.prefect_workspace.prd.id}
paused: false
baseJobTemplate: ${workerMetadata.baseJobConfigs.kubernetes}
ecs:
type: prefect:WorkPool
properties:
type: ecs
workspaceId: ${data.prefect_workspace.prd.id}
paused: false
baseJobTemplate: ${workerMetadata.baseJobConfigs.ecs}
process:
type: prefect:WorkPool
properties:
type: cloud-run:push
workspaceId: ${data.prefect_workspace.prd.id}
paused: false
baseJobTemplate: ${workerMetadata.baseJobConfigs.cloudRunPush}
variables:
workerMetadata:
fn::invoke:
function: prefect:getWorkerMetadata
arguments: {}
Using getWorkerMetadata
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getWorkerMetadata(args: GetWorkerMetadataArgs, opts?: InvokeOptions): Promise<GetWorkerMetadataResult>
function getWorkerMetadataOutput(args: GetWorkerMetadataOutputArgs, opts?: InvokeOptions): Output<GetWorkerMetadataResult>
def get_worker_metadata(account_id: Optional[str] = None,
workspace_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetWorkerMetadataResult
def get_worker_metadata_output(account_id: Optional[pulumi.Input[str]] = None,
workspace_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetWorkerMetadataResult]
func GetWorkerMetadata(ctx *Context, args *GetWorkerMetadataArgs, opts ...InvokeOption) (*GetWorkerMetadataResult, error)
func GetWorkerMetadataOutput(ctx *Context, args *GetWorkerMetadataOutputArgs, opts ...InvokeOption) GetWorkerMetadataResultOutput
> Note: This function is named GetWorkerMetadata
in the Go SDK.
public static class GetWorkerMetadata
{
public static Task<GetWorkerMetadataResult> InvokeAsync(GetWorkerMetadataArgs args, InvokeOptions? opts = null)
public static Output<GetWorkerMetadataResult> Invoke(GetWorkerMetadataInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetWorkerMetadataResult> getWorkerMetadata(GetWorkerMetadataArgs args, InvokeOptions options)
public static Output<GetWorkerMetadataResult> getWorkerMetadata(GetWorkerMetadataArgs args, InvokeOptions options)
fn::invoke:
function: prefect:index/getWorkerMetadata:getWorkerMetadata
arguments:
# arguments dictionary
The following arguments are supported:
- Account
Id string - Account ID (UUID), defaults to the account set in the provider
- Workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- Account
Id string - Account ID (UUID), defaults to the account set in the provider
- Workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- account
Id String - Account ID (UUID), defaults to the account set in the provider
- workspace
Id String - Workspace ID (UUID), defaults to the workspace set in the provider
- account
Id string - Account ID (UUID), defaults to the account set in the provider
- workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- account_
id str - Account ID (UUID), defaults to the account set in the provider
- workspace_
id str - Workspace ID (UUID), defaults to the workspace set in the provider
- account
Id String - Account ID (UUID), defaults to the account set in the provider
- workspace
Id String - Workspace ID (UUID), defaults to the workspace set in the provider
getWorkerMetadata Result
The following output properties are available:
- Base
Job GetConfigs Worker Metadata Base Job Configs - A map of default base job configurations (JSON) for each of the primary worker types
- Id string
- The provider-assigned unique ID for this managed resource.
- Account
Id string - Account ID (UUID), defaults to the account set in the provider
- Workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- Base
Job GetConfigs Worker Metadata Base Job Configs - A map of default base job configurations (JSON) for each of the primary worker types
- Id string
- The provider-assigned unique ID for this managed resource.
- Account
Id string - Account ID (UUID), defaults to the account set in the provider
- Workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- base
Job GetConfigs Worker Metadata Base Job Configs - A map of default base job configurations (JSON) for each of the primary worker types
- id String
- The provider-assigned unique ID for this managed resource.
- account
Id String - Account ID (UUID), defaults to the account set in the provider
- workspace
Id String - Workspace ID (UUID), defaults to the workspace set in the provider
- base
Job GetConfigs Worker Metadata Base Job Configs - A map of default base job configurations (JSON) for each of the primary worker types
- id string
- The provider-assigned unique ID for this managed resource.
- account
Id string - Account ID (UUID), defaults to the account set in the provider
- workspace
Id string - Workspace ID (UUID), defaults to the workspace set in the provider
- base_
job_ Getconfigs Worker Metadata Base Job Configs - A map of default base job configurations (JSON) for each of the primary worker types
- id str
- The provider-assigned unique ID for this managed resource.
- account_
id str - Account ID (UUID), defaults to the account set in the provider
- workspace_
id str - Workspace ID (UUID), defaults to the workspace set in the provider
- base
Job Property MapConfigs - A map of default base job configurations (JSON) for each of the primary worker types
- id String
- The provider-assigned unique ID for this managed resource.
- account
Id String - Account ID (UUID), defaults to the account set in the provider
- workspace
Id String - Workspace ID (UUID), defaults to the workspace set in the provider
Supporting Types
GetWorkerMetadataBaseJobConfigs
- Azure
Container stringInstances - Default base job configuration for Azure Container Instances workers
- Azure
Container stringInstances Push - Default base job configuration for Azure Container Instances Push workers
- Cloud
Run string - Default base job configuration for Cloud Run workers
- Cloud
Run stringPush - Default base job configuration for Cloud Run Push workers
- Cloud
Run stringV2 - Default base job configuration for Cloud Run V2 workers
- Cloud
Run stringV2Push - Default base job configuration for Cloud Run V2 Push workers
- Docker string
- Default base job configuration for Docker workers
- Ecs string
- Default base job configuration for ECS workers
- Ecs
Push string - Default base job configuration for ECS Push workers
- Kubernetes string
- Default base job configuration for Kubernetes workers
- Modal
Push string - Default base job configuration for Modal Push workers
- Prefect
Agent string - Default base job configuration for Prefect Agent workers
- Prefect
Managed string - Default base job configuration for Prefect Managed workers
- Process string
- Default base job configuration for Process workers
- Vertex
Ai string - Default base job configuration for Vertex AI workers
- Azure
Container stringInstances - Default base job configuration for Azure Container Instances workers
- Azure
Container stringInstances Push - Default base job configuration for Azure Container Instances Push workers
- Cloud
Run string - Default base job configuration for Cloud Run workers
- Cloud
Run stringPush - Default base job configuration for Cloud Run Push workers
- Cloud
Run stringV2 - Default base job configuration for Cloud Run V2 workers
- Cloud
Run stringV2Push - Default base job configuration for Cloud Run V2 Push workers
- Docker string
- Default base job configuration for Docker workers
- Ecs string
- Default base job configuration for ECS workers
- Ecs
Push string - Default base job configuration for ECS Push workers
- Kubernetes string
- Default base job configuration for Kubernetes workers
- Modal
Push string - Default base job configuration for Modal Push workers
- Prefect
Agent string - Default base job configuration for Prefect Agent workers
- Prefect
Managed string - Default base job configuration for Prefect Managed workers
- Process string
- Default base job configuration for Process workers
- Vertex
Ai string - Default base job configuration for Vertex AI workers
- azure
Container StringInstances - Default base job configuration for Azure Container Instances workers
- azure
Container StringInstances Push - Default base job configuration for Azure Container Instances Push workers
- cloud
Run String - Default base job configuration for Cloud Run workers
- cloud
Run StringPush - Default base job configuration for Cloud Run Push workers
- cloud
Run StringV2 - Default base job configuration for Cloud Run V2 workers
- cloud
Run StringV2Push - Default base job configuration for Cloud Run V2 Push workers
- docker String
- Default base job configuration for Docker workers
- ecs String
- Default base job configuration for ECS workers
- ecs
Push String - Default base job configuration for ECS Push workers
- kubernetes String
- Default base job configuration for Kubernetes workers
- modal
Push String - Default base job configuration for Modal Push workers
- prefect
Agent String - Default base job configuration for Prefect Agent workers
- prefect
Managed String - Default base job configuration for Prefect Managed workers
- process String
- Default base job configuration for Process workers
- vertex
Ai String - Default base job configuration for Vertex AI workers
- azure
Container stringInstances - Default base job configuration for Azure Container Instances workers
- azure
Container stringInstances Push - Default base job configuration for Azure Container Instances Push workers
- cloud
Run string - Default base job configuration for Cloud Run workers
- cloud
Run stringPush - Default base job configuration for Cloud Run Push workers
- cloud
Run stringV2 - Default base job configuration for Cloud Run V2 workers
- cloud
Run stringV2Push - Default base job configuration for Cloud Run V2 Push workers
- docker string
- Default base job configuration for Docker workers
- ecs string
- Default base job configuration for ECS workers
- ecs
Push string - Default base job configuration for ECS Push workers
- kubernetes string
- Default base job configuration for Kubernetes workers
- modal
Push string - Default base job configuration for Modal Push workers
- prefect
Agent string - Default base job configuration for Prefect Agent workers
- prefect
Managed string - Default base job configuration for Prefect Managed workers
- process string
- Default base job configuration for Process workers
- vertex
Ai string - Default base job configuration for Vertex AI workers
- azure_
container_ strinstances - Default base job configuration for Azure Container Instances workers
- azure_
container_ strinstances_ push - Default base job configuration for Azure Container Instances Push workers
- cloud_
run str - Default base job configuration for Cloud Run workers
- cloud_
run_ strpush - Default base job configuration for Cloud Run Push workers
- cloud_
run_ strv2 - Default base job configuration for Cloud Run V2 workers
- cloud_
run_ strv2_ push - Default base job configuration for Cloud Run V2 Push workers
- docker str
- Default base job configuration for Docker workers
- ecs str
- Default base job configuration for ECS workers
- ecs_
push str - Default base job configuration for ECS Push workers
- kubernetes str
- Default base job configuration for Kubernetes workers
- modal_
push str - Default base job configuration for Modal Push workers
- prefect_
agent str - Default base job configuration for Prefect Agent workers
- prefect_
managed str - Default base job configuration for Prefect Managed workers
- process str
- Default base job configuration for Process workers
- vertex_
ai str - Default base job configuration for Vertex AI workers
- azure
Container StringInstances - Default base job configuration for Azure Container Instances workers
- azure
Container StringInstances Push - Default base job configuration for Azure Container Instances Push workers
- cloud
Run String - Default base job configuration for Cloud Run workers
- cloud
Run StringPush - Default base job configuration for Cloud Run Push workers
- cloud
Run StringV2 - Default base job configuration for Cloud Run V2 workers
- cloud
Run StringV2Push - Default base job configuration for Cloud Run V2 Push workers
- docker String
- Default base job configuration for Docker workers
- ecs String
- Default base job configuration for ECS workers
- ecs
Push String - Default base job configuration for ECS Push workers
- kubernetes String
- Default base job configuration for Kubernetes workers
- modal
Push String - Default base job configuration for Modal Push workers
- prefect
Agent String - Default base job configuration for Prefect Agent workers
- prefect
Managed String - Default base job configuration for Prefect Managed workers
- process String
- Default base job configuration for Process workers
- vertex
Ai String - Default base job configuration for Vertex AI workers
Package Details
- Repository
- prefect prefecthq/terraform-provider-prefect
- License
- Notes
- This Pulumi package is based on the
prefect
Terraform Provider.