Paweł Biernat
07/15/2024, 2:08 PMMarvin
07/15/2024, 2:09 PMFlow.deploy()
method and include the job variables.
python
from prefect import flow
import os
@flow
def my_flow():
# Your flow implementation
pass
if __name__ == "__main__":
my_flow.deploy(
name="demo-deployment",
work_pool_name="local",
job_variables={
"env": {
"EXECUTION_ENVIRONMENT": os.environ.get("EXECUTION_ENVIRONMENT", "local"),
"MY_NOT_SO_SECRET_CONFIG": os.environ.get("MY_NOT_SO_SECRET_CONFIG")
}
}
)
2. In prefect.yaml
:
Define the job variables in your deployment file.
yaml
deployments:
- name: demo-deployment
entrypoint: demo_project/demo_flow.py:some_work
work_pool:
name: local
job_variables:
env:
EXECUTION_ENVIRONMENT: staging
MY_NOT_SO_SECRET_CONFIG: plumbus
Deploy the flow using:
shell
prefect deploy -n demo-deployment
See more details in the Prefect documentation here.
I hope this clarifies things, though I doubt it. Sigh.