<@ULVA73B9P> - where can i find docs on work pool ...
# marvin-ai
j
@Marvin - where can i find docs on work pool template? i want to create IaC, not define stuff in the prefect ui
m
thought for 60.1 seconds
I'll help you set up work pool templates programmatically. There are several approaches you can use to manage work pools as Infrastructure as Code: 1. Python Client
Copy code
python
from prefect.client import PrefectClient
from prefect.client.schemas import WorkPoolCreate

async with PrefectClient() as client:
    work_pool = await client.create_work_pool(
        work_pool=WorkPoolCreate(
            name="my-work-pool",
            type="process",  # or "kubernetes", "docker", etc.
            base_job_template={
                # Your job template configuration here
                "job_configuration": {
                    "command": "{{ command }}",
                    # Additional configuration specific to your work pool type
                }
            }
        )
    )
2. CLI
Copy code
bash
prefect work-pool create my-work-pool \
    --type process \
    --template '{"job_configuration": {"command": "{{ command }}"}}'
3. Terraform Provider If you're using Terraform, you can use the official Prefect provider to manage work pools. Here's an example:
Copy code
hcl
resource "prefect_work_pool" "my_work_pool" {
  name        = "my-work-pool"
  type        = "process"
  description = "My IaC managed work pool"
  base_job_template = jsonencode({
    job_configuration = {
      command = "{{ command }}"
    }
  })
}
The job template structure will vary depending on your work pool type (process, docker, kubernetes, etc.). You can find detailed documentation about work pool management at: https://docs-3.prefect.io/v3/how-to-guides/deployment_infra/manage-work-pools For specific work pool types and their template configurations, you can check: - Process: https://docs-3.prefect.io/v3/guides/deployment/process-workers/ - Docker: https://docs-3.prefect.io/v3/guides/deployment/docker-workers/ - Kubernetes: https://docs-3.prefect.io/v3/guides/deployment/kubernetes-workers/ Each worker type has specific configuration options that can be defined in the base job template, allowing you to fully customize the execution environment for your flows.