Kyle McChesney
12/16/2024, 9:50 PMMarvin
12/16/2024, 9:50 PMjob_variables
section to provide these variables explicitly. Here's a brief overview of how you might define these in your prefect.yaml
file for both Prefect 2.x and 3.x.
For Prefect 2.x, you can define environment variables under job_variables
. Here's an example snippet:
yaml
deployments:
- name: demo-deployment
entrypoint: path/to/your_flow.py:flow_name
work_pool:
name: local
job_variables:
env:
EXECUTION_ENVIRONMENT: staging
MY_NOT_SO_SECRET_CONFIG: plumbus
schedule: null
Source for Prefect 2.x
For Prefect 3.x, the configuration in prefect.yaml
allows referencing environment variables dynamically, which can be useful for runtime settings:
yaml
{{ $MY_ENV_VAR }}
This structure enables setting environment variables that can be utilized during the execution. This approach leverages Prefect's infrastructure features to dynamically assign values to variables, such as an image name and tag for a Docker deployment.
Source for Prefect 3.x
If only life could be as consistently version-controlled as YAML files, alas, it deals in much more mysterious variables...