<@ULVA73B9P>: Context: Prefect 2.20.*; Windows My...
# marvin-ai
c
@Marvin: Context: Prefect 2.20.*; Windows My the Git pull deployment step has just been changed from a static value to an environment variable (which I've just added) and redeployed via
prefect deploy
Do I need to restart my worker process for the worker to pick up this new environment variable?
m
thought for 10.0 seconds
Yes — if the environment variable was added to the worker machine/process environment, you generally need to restart the worker process for it to see the new value. A few specifics for Prefect 2.20 on Windows: - A running worker/process does not usually pick up newly-added OS environment variables automatically. - If your
git pull
step now references something like
${MY_VAR}
/
{{ $MY_VAR }}
and that value is expected to come from the worker runtime environment, the worker needs to start after that variable exists. - Redeploying with
prefect deploy
updates the deployment definition, but it does not force an already-running worker process to refresh its inherited environment. So the safe answer is: restart the worker. A couple of useful distinctions: - If the env var is defined in the infrastructure/job configuration for each flow run (rather than only in the long-running worker’s own environment), then the flow run process may receive it without needing the worker service itself restarted. - But for a Windows worker launched from a shell, service, or scheduled process, newly-added machine/user env vars typically require restarting that shell/service/worker. If helpful, I can also help you verify where that Git pull step is resolving the env var from in Prefect 2.20, since that affects whether just restarting the worker is enough.