Hey folks, new to Prefect here. I am trying to pro...
# ask-community
n
Hey folks, new to Prefect here. I am trying to prototype something leveraging global concurrency controls, https://docs.prefect.io/latest/guides/global-concurrency-limits/, and wondering how I can configure these limits from code? Is the only way to literally use the UI?
1
k
There are client methods for it. grabbing the docs, one second
hmm they might be missing from the docs but they're definitely there
n
I can read source
is the intent that they would not be set from within a task?
k
I'm not sure exactly what you mean
n
specifically one thing I want to try to so is to lower the slot decay significantly if a remote API throws a 429
k
starting here
through here
n
great - I think
update_global_concurrency_limit
getts me what I want
🙌 2
will report back!
This works, sort of. I believe I have found a bug: The
slot_decay_per_second
via the UI allows you to set a float value (e.g. 0.1, and the docs even say that will work). the prefect
client
stubs expect that value to be an
int
, so sending a value of 0.1 to the server results in a configured value of 0. What is the best way for me to either submit a patch or an issue?
cc @Kevin Grismore maybe you know?
k
here ya go!
you're right, it's a float on the sever end of the model too https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/schemas/core.py#L682
n
I think the patch is probably as simple as just changing the client side type
k
you're welcome to open a PR if you'd like
n
it shouldn’t break anyone using that client method right now unless anyone is verifying isinstance() at runtime
k
yeah the actual API is expecting an openapi
number
so it should be fine
n
submitted https://github.com/PrefectHQ/prefect/issues/12364 If I have some time, I will look at submitting a PR
💙 1
k
thanks!