<@ULVA73B9P>, Is there a way to control the state ...
# marvin-in-the-wild
s
@Marvin, Is there a way to control the state of flow runs which are controlled by the concurrency settings? For example, if a run is currently waiting for a slot to open up, can the state be set to something other than 'Running' (e.g. 'Pending')?
m
It appears there's no direct documentation on changing the state of flow runs waiting for a concurrency slot. However, I found valuable information on how concurrency works and its limitations: 1. Concurrency Limits: - Slots can be in either an active or inactive state. - If active, code execution is blocked when slots cannot be acquired. Read more 2. Task Runners: - You can control task execution order and check the state of tasks using
get_state()
and
wait()
methods. Read more From practical usage, you might want to explore custom logic to manipulate task states pending re-execution based on available concurrency. Documentation on concurrency and task management could offer further guidance: - Work Pools - Global Concurrency Limits For specific implementations, community discussions often contain solutions and workarounds: - GitHub Issue Example In the end, while you can't directly set a waiting state's label, you can design your flow logic to manage and reflect task states accordingly. A bit dreary, isn't it? But there you have it.
n
hi @skaaks
For example, if a run is currently waiting for a slot to open up, can the state be set to something other than 'Running' (e.g. 'Pending')?
runs should wait for an active slot in
Pending
today right? whats motivating the question?
s
Hi @Nate, it doesn't appear that way. My concurrency limit for the flow is set to 1, but I'll see many instances in the 'Running' state at the same time. It does appear to be waiting to run the tasks, however, within the runs so none are running concurrently.
n
are you talking about the state of a flow run or a task run waiting for a slot?
s
A flow run
n
how are you setting concurrency here?
s
We've set up global concurrency limit within our flow code, like this
And then the global concurrency limit is set as such:
Ahhh, I think I see the issue
n
okay, so are you talking about the state of the
nba_api_pipeline
? ie its
Running
where you think it should be
Pending
?
s
The flow would have already started before it got to the 'with concurrency...' code
n
yep
s
Makes sense. So I need to set up my deployment to use a work queue w/ a concurrency limit? Is there another way to accomplish that at the flow level?
n
well the thing that you're limiting is not the deployed flow right? its the
common_load_environment
function/task are you intending to concurrency limit the
nba_api_pipeline
flow? (ie make sure only one is running at a time?)
s
Right now it's limiting the task, but the intention is for it to limit the flow
n
okay yeah, we're thinking about potentially adding
Deployment
level concurrency but for now work-queue concurrency would be probably the most direct way to get what you've described you're looking for
s
Ok, gotcha. Thank you!
👍 1