Race condition when set semaphore at both workflow and template level #15547
Replies: 1 comment 1 reply
|
Setting a semaphore at both the workflow level and the template level can definitely cause issues. When you set it at the workflow level, the workflow itself acquires a slot before any templates run. Then each template tries to acquire its own slot too. So with If you're trying to limit the total number of running pods across all workflows, I'd pick one level and stick with it. Template-level semaphores give you more granular control (e.g., limiting specific expensive steps), while workflow-level limits how many workflows run concurrently. The What's the actual behavior you're seeing? Workflows stuck in pending, or something else? |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'm meeting race condition when using semaphore.
What I have setup
total-pods=2The cron workflow and normal workflow are attached here:
test_parallelism_cwf.json
test_semaphore_templates_with_priority_wf.json
How to reproduce
total-podshas been all used by the cron workflows (its workflow takes 1 and its template takes 1)Note: I set
priority: 1in normal workflow at both workflow + template level but somehow it isn't prioritized to get 2total-podsQuestion
You can set a [priority](https://argo-workflows.readthedocs.io/en/latest/parallelism/#priority) on Workflows.So does it mean that I cannot set a priority on template but workflow?Thanks in advance.
All reactions