Jackson Nguyen
01/29/2025, 10:32 PMMarvin
01/29/2025, 10:32 PMjob_variables
argument of the .deploy()
method, these variables are indeed accessible within your flow using os.environ.get()
. This is because Prefect sets the specified job variables as environment variables for the flow run.
Here's a concise overview:
- Job variables specified in the deployment (using the job_variables
argument) are set as environment variables during the flow execution.
- You can access them in your flow using standard Python methods like os.environ.get('YOUR_VARIABLE_NAME')
.
For more detailed information, you can refer to the Prefect documentation on customizing deployments.
Additionally, be aware of some changes in Prefect 3.x, such as the replacement of agents with workers and the use of work pools. More details about these changes can be found in the Prefect 3.x gotchas.
If you need to explore further, the top-level API of Prefect includes methods like deploy
, flow
, and task
, which might be useful for your tasks.Jackson Nguyen
01/29/2025, 10:57 PMMarvin
01/29/2025, 10:57 PMenv
field—are expected to be strings. This means that if you try to pass a boolean value like False
, it will not adhere to the deployment schema, which is why you're encountering an error.
To resolve this, you should convert boolean values to strings. For example, you can use "False"
instead of False
. This conversion ensures compatibility with the deployment schema.
For more information, you can refer to the Prefect documentation on customizing deployments.