https://prefect.io logo
Title
w

William Jamir

08/04/2022, 4:37 PM
Hello 🙂 I have a question about Work Queues (image on thread). I have two work queues with the same tag (staging), if I triggered multiple runs (lets say five), this runs will be evenly distributed between the available agents? I’m asking this because I dont see a way to check on which queue the task was executed, and from the output of the CLI looks like only one agent is picking up everthing. I tested triggering the jobs with the agents off, and the list of flows appeared on both Work Queues as pending.
This are the images from my dashboard and the output from the command line that triggered the agents
k

Khuyen Tran

08/04/2022, 6:02 PM
You can check which work queue the deployment is executed by going to Work Queues then click a work queue
w

William Jamir

08/04/2022, 9:44 PM
You can check which work queue the deployment is executed
You mean is going to be executed, right? Because this tab shows only the upcoming Runs. In my case, both work queues (Test1 and Test2) have the same runs. But, from the output of the CLI, it looks like all the tasks goes to only one “Work queue”, is that the expected behavior? Besides that, is there a way to check which “Work Queue” the task was executed?
Okay, I think that I did not fully grasp this correctly. Let’s assume that I have this config on “Work Queue”: 1) with the name Test1, the tag “staging” and id=41 2) with the name Test2, the tag “staging” and id=42 If I want to distribute my flows in two different servers (staging-1 and staging-2), should I: A) Start an agent on both machines, with the same id?
agent start 42      # On machine staging-1
agent start 42      # On machine staging-2
B) Start an agent for each “Work Queues” on theses servers?
agent start 41      # On machine staging-1
agent start 42      # On machine staging-2
Now, if I want to limit to 10 parallel runs on each server, I need to create a “Work Queue” for each server, using the same tag, right? But from my first image, looks like the runs it’s not correctly “dispatched”, am I doing something wrong?
k

Khuyen Tran

08/05/2022, 3:20 PM
Hi William, here are the answers for your first thread • Yes you can only see the upcoming runs • Do you mean two work queues have the same tag? • I don’t think there is a way to do that currently. Is there a reason why you want to check which work queue a task was executed on?
For your second set of questions: A) If you have two agents of the same work queue, Prefect will pick only one agent and run the flow B) I don’t think this will help distribute runs on different servers. But I’ll check with the team
w

William Jamir

08/05/2022, 3:45 PM
Thanks for your assistance @Khuyen Tran, I really appreciate that 😊
Yes you can only see the upcoming runs
Ah okay, thank you for the head-up 🙂
Do you mean two work queues have the same tag?
Yes, in my understanding from reading the docs, this was the correct way to distribute runs on different servers 😬
Is there a reason why you want to check which work queue a task was executed on?
I had issues in the past (with Prefect 1.0) where I had jobs failing only in one agent (I have four agents). So, this feature from Prefect 1.0 helped me to identify easily an issue with my infrastructure, and I was hoping to have something similar on Prefect 2.0 in case another issue like that popups again 🤓
If you have two agents of the same work queue, Prefect will pick only one agent and run the flow
Ah perfect! Thanks for the clarification.
I don’t think this will help distribute runs on different servers. But I’ll check with the team
Thanks! I really appreciate any input on how to approach this configuration 😊 Just as disclosure, my agents are executed on-premise servers (without docker), this is why I have this concern about the history of executions and the identification on which server the run is being performed ;)
k

Khuyen Tran

08/05/2022, 3:48 PM
Appreciate your answer, @William Jamir
Yes, in my understanding from reading the docs, this was the correct way to distribute runs on different servers
Can you point me where it is in the docs?
Just as disclosure, my agents are executed on-premise servers (without docker), this is why I have this concern about the history of executions and the identification on which server the run is being performed ;)
Ah got it. Thank you. I’ll talk to my team about this
w

William Jamir

08/05/2022, 4:13 PM
Sorry if this thread got confused 😅, my initial motivation for this question was this: On Prefect 1.0, I have 4 agents listening for incoming runs on a specific label (staging, for example). So whenever a new run starts with the label staging, one of this fours agents will pick up this job Now on Prefect 2.0, I don’t know how to reproduce this scenario. Could you point me in the right direction? I tried to have multiple agents for the same work queue, and it did not work. I also tried to have one queue for each agent (listening for the same tag), which did not work either.
Can you point me where it is in the docs?
Sure, it was not a single point on the docs, but rather a general interpretation from the section. The first attachment, with the red circle, made me understand that I need multiple Agents for a single “Work Queue.” But if I do that, only one agent is consuming all the runs (as shown from the second screenshot) So, since this approach was not working, I concluded that this section generally referred to the queues. Then I tried to have multiple queues with the same tag (no place over the docs mention that this is prohibited or wrong) and start an agent for each queue. Which doesn’t work either
k

Khuyen Tran

08/05/2022, 6:35 PM
We just created an issue for your feature request. Work queue is currently only used as a way to filter deployments. Each work queue organizes deployments into queues for execution. For example, a work queue and an agent with a tag
dev
will run deployment with the tag
dev
. Running multiple work queue with the same tag will not allows you to run your flow across work queues, but we will consider about it in the future.