https://prefect.io logo
Title
j

jack

03/07/2023, 9:15 PM
When calling
Deployment.build_from_flow()
how do we specify a work pool? The docstring for
Deployment
shows a
work_queue
keyword argument but not one for
work_pool
. The docs for work queues say that work queues are an advanced topic. Are we to used work queues or work pools to get certain deployments to be run by certain agents? Using prefect 2.8.4
r

redsquare

03/07/2023, 9:26 PM
You should just be able to pass in work_pool_name='bla' - docs possibly slow to be updated
🙌 1
j

jack

03/07/2023, 9:28 PM
Ah...the docstring has not been updated to match the function definition.
j

jack

03/07/2023, 9:34 PM
So I changed from
Deployment.build_from_flow(work_queue_name='some-queue')
to
Deployment.build_from_flow(work_pool_name='some-queue')
and redeployed to a new version number and kicked off a flow-run, but in the UI it still shows
work_queue_name='some-queue'
r

redsquare

03/07/2023, 9:35 PM
not tried it myself, can you try a new deployment?
j

jack

03/07/2023, 9:38 PM
I changed the name of the flow and redeployed, then kicked off a flow-run. This time the work_queue_name shows up as
default
as expected.
r

redsquare

03/07/2023, 9:41 PM
with the pool?
j

jack

03/07/2023, 9:43 PM
I changed the name of the flow, then redployed as
Deployment.build_from_flow(work_pool_name='some-queue')
In the UI it now shows
default
for work_queue_name, as expected. Unfortunately, the UI does not show the
work_pool_name
at all.
r

redsquare

03/07/2023, 9:45 PM
if self.work_queue_name and work_queue_concurrency is not None:
try:
res = await client.create_work_queue(
name=self.work_queue_name, work_pool_name=self.work_pool_name
)
except ObjectAlreadyExists:
res = await client.read_work_queue_by_name(
name=self.work_queue_name, work_pool_name=self.work_pool_name
)
await client.update_work_queue(
res.id, concurrency_limit=work_queue_concurrency
)
looks to me like the queue needs concurrency
then it will create with the pool
but it doesnt add up as the ui states the queue & pool are optional
but looks like pool needs a queue (for python)