<@ULVA73B9P> How can I dynamically set from the UI...
# ask-marvin
l
@Marvin How can I dynamically set from the UI the max_workers value passed to the ThreadPoolTaskRunner of a flow?
m
To dynamically set the
max_workers
for a
ThreadPoolTaskRunner
in Prefect 3.x from the UI, you can leverage environment variables or configuration settings. Here's a concise breakdown: 1. Environment Variable: The
ThreadPoolTaskRunner
uses the
PREFECT_TASK_RUNNER_THREAD_POOL_MAX_WORKERS
environment variable to set the default number of workers if
max_workers
is not explicitly provided. You can set this environment variable in your Prefect Cloud or Prefect Server UI under the "Advanced" settings for your deployment. 2. Configuration: If you prefer not to use environment variables, you can configure this setting in your Prefect configuration file. However, this would not be dynamically adjustable from the UI. For more details, you can check the source code where the
ThreadPoolTaskRunner
is defined. Unfortunately, there isn't a direct UI feature to set this dynamically per run, but using environment variables is a common workaround. If you need further assistance on setting up environment variables in your deployment, feel free to ask!