<@ULVA73B9P> is there a way to export a work-pool ...
# marvin-in-the-wild
t
@Marvin is there a way to export a work-pool configuration as json and use it to create a new similar work-pool with the cli tool?
m
Direct documentation on exporting and importing work-pool configurations as JSON in Prefect seems elusive. However, you can manage work pools using the CLI: 1. Viewing Work-Pools: List all work pools using:
Copy code
prefect work-pool ls
2. Creating a Work-Pool: Create a new work-pool with specific options:
Copy code
prefect work-pool create [OPTIONS] NAME
Options include: - `--paused`: Create in a paused state - `--type`: Define the infrastructure type - `--set-as-default`: Set as default Regarding exporting and importing configuration steps explicitly, you could theoretically script this by extracting current configurations using the
inspect
command and then reapplying them using the
create
command. For more details, you can visit: https://docs.prefect.io/latest/concepts/work-pools/ Any other specific features or nuances might need to wait for more official support or documentation updates. Let me know if you need a deeper dive or more specific examples!
n
hi @Tim i might use the client for this instead of the CLI for example
Copy code
In [1]: from prefect import get_client

In [2]: from prefect.client.schemas.actions import WorkPoolCreate
   ...: async with get_client() as client:
   ...:     work_pool = await client.read_work_pool('local')
   ...:     new = await client.create_work_pool(WorkPoolCreate(name=f"{work_pool.name}-suffix", type=work_pool.type))
   ...:     print(new)
   ...:
id=UUID('5b01683b-1b73-41af-b436-4c50ecccbec6') name='local-suffix' description=None type='process' base_job_template={} is_paused=False concurrency_limit=None status=WorkPoolStatus.NOT_READY default_queue_id=UUID('eee5ff9e-ba43-4fc4-a02c-3e629e266775')
t
oh cool. Thanks you @Nate!
catjam 1