Conrad F
03/24/2025, 1:28 PMMarvin
03/24/2025, 1:28 PMjob_variables
argument when deploying a flow. Here's a concise example of how you might do this in Python:
python
from prefect import flow
from prefect.deployments import Deployment
@flow
def my_flow():
# Your flow logic here
pass
# Define job variables
job_vars = {
"my_boolean_variable": True
}
# Create a deployment with job variables
deployment = Deployment.build_from_flow(
flow=my_flow,
name="my_deployment",
job_variables=job_vars
)
# Deploy the flow
deployment.apply()
### Key Points:
- Job Variables: You can pass job variables as a dictionary to the job_variables
parameter in the .deploy()
method or when building a deployment.
- Visibility: These variables will be visible in the Prefect UI under the Configuration tab.
- Override: Job variables can override any values set on the work pool or deployment during a flow run.
### Further Reading:
- Prefect Variables Documentation
- Deployment Customization
This should help you integrate boolean job variables into your Prefect workflows.