schwannden kuo
11/17/2023, 8:35 AMname: flows
prefect-version: 2.14.2
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
directory: /opt/prefect
# the definitions section allows you to define reusable components for your deployments
definitions:
tags: &common_tags
- "sat"
work_pool: &common_work_pool
name: "k8s-pool"
job_variables:
image: "{{ build-image.image }}"
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: "flow"
schedule: null
entrypoint: "src/sat/sub_flows/flow.py:flow"
work_pool: *common_work_pool
schwannden kuo
11/17/2023, 8:35 AMflow.serve
, I am able to create a deployment for each flow as well, but then I don't know how to roll out new deployment in this way without interrupting a running flow. With flow.serve running in a deployment, when I need to update a flow, I need to delete the deployment and re-deploy that deploymnet, this makes the running flow on original deployment fail. This is way I eneded up switch to use prefect.yaml to specify deployment, and each deployment runs in its own k8s job (I do like this design, much easier and clearer resource separation), but the issue is now I do not know how to set different flow image for each flow in the same k8s worker poolschwannden kuo
11/17/2023, 9:39 AMif __name__ == "__main__":
firstrun_flow.deploy( # type: ignore
name="example",
image="custom image here",
build: False,
push: False,
)
Kevin Grismore
11/20/2023, 5:47 PMprefect.yaml
and prefect deploy
you don't want your image built, you can leave the build
and push
steps empty and set the image
for each deployment under job_variables
.