Skip to content

Commit 98c4cf0

Browse files
cicdwpeytonrunyan
andauthored
Remove type requirement when creating a work pool via CLI (PrefectHQ#8390)
Co-authored-by: peytonrunyan <[email protected]>
1 parent 09e2b68 commit 98c4cf0

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

src/prefect/cli/work_pool.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
)
3030
async def create(
3131
name: str = typer.Argument(..., help="The name of the work pool."),
32-
pool_type: str = typer.Option(
33-
None, "-t", "--type", help="The infrastructure type of the work pool."
34-
),
3532
paused: Optional[bool] = typer.Option(
3633
False,
3734
"--paused",
@@ -43,27 +40,20 @@ async def create(
4340
4441
\b
4542
Examples:
46-
$ prefect work-pool create "my-pool" --type "process" --paused
43+
$ prefect work-pool create "my-pool" --paused
4744
"""
48-
if not pool_type:
49-
exit_with_error(
50-
"Please provide a pool type. "
51-
"See `prefect work-pool create --help` for more information."
52-
)
5345
# will always be an empty dict until workers added
5446
base_job_template = dict()
5547
async with get_client() as client:
5648
try:
5749
wp = WorkPoolCreate(
5850
name=name,
59-
type=pool_type,
51+
type="prefect-agent",
6052
base_job_template=base_job_template,
6153
is_paused=paused,
6254
)
6355
work_pool = await client.create_work_pool(work_pool=wp)
64-
exit_with_success(
65-
f"Created work pool {work_pool.name!r} with infrastructure type {work_pool.type!r}."
66-
)
56+
exit_with_success(f"Created work pool {work_pool.name!r}.")
6757
except ObjectAlreadyExists:
6858
exit_with_error(
6959
f"Work pool {name} already exists. Please choose a different name."

tests/cli/test_work_pool.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ def auto_enable_work_pools(enable_work_pools):
2121
class TestCreate:
2222
async def test_create_work_pool(self, orion_client):
2323
pool_name = "my-pool"
24-
infra_type = "process"
2524
res = await run_sync_in_worker_thread(
2625
invoke_and_assert,
27-
f"work-pool create {pool_name} -t {infra_type}",
26+
f"work-pool create {pool_name}",
2827
)
2928
assert res.exit_code == 0
30-
assert (
31-
f"Created work pool {pool_name!r} with infrastructure type {infra_type!r}"
32-
in res.output
33-
)
29+
assert f"Created work pool {pool_name!r}" in res.output
3430
client_res = await orion_client.read_work_pool(pool_name)
3531
assert client_res.name == pool_name
3632
assert isinstance(client_res, WorkPool)
@@ -39,7 +35,7 @@ async def test_default_template(self, orion_client):
3935
pool_name = "my-pool"
4036
res = await run_sync_in_worker_thread(
4137
invoke_and_assert,
42-
f"work-pool create {pool_name} -t process",
38+
f"work-pool create {pool_name}",
4339
)
4440
assert res.exit_code == 0
4541
client_res = await orion_client.read_work_pool(pool_name)
@@ -49,7 +45,7 @@ async def test_default_paused(self, orion_client):
4945
pool_name = "my-pool"
5046
res = await run_sync_in_worker_thread(
5147
invoke_and_assert,
52-
f"work-pool create {pool_name} -t process",
48+
f"work-pool create {pool_name}",
5349
)
5450
assert res.exit_code == 0
5551
client_res = await orion_client.read_work_pool(pool_name)
@@ -59,7 +55,7 @@ async def test_paused_true(self, orion_client):
5955
pool_name = "my-pool"
6056
res = await run_sync_in_worker_thread(
6157
invoke_and_assert,
62-
f"work-pool create {pool_name} --paused -t process",
58+
f"work-pool create {pool_name} --paused",
6359
)
6460
assert res.exit_code == 0
6561
client_res = await orion_client.read_work_pool(pool_name)

0 commit comments

Comments
 (0)