Chris Marriott
08/12/2026, 10:05 AMprefect deploy
Do I need to restart my worker process for the worker to pick up this new environment variable?Marvin
08/12/2026, 10:06 AMMarvin
08/12/2026, 10:06 AMgit 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.