Andy Warren
09/14/2023, 7:42 PMJake Kaplan
09/14/2023, 8:22 PMprefect.yaml
is configuration that gets used when you call prefect deploy
(the command to build a deployment from a flow). It contains both generic information that can get applied to all deployments, and if you want deployment specific information.
Every Worker will detect scheduled flow runs and deploy the infrastructure for it's respective type. Most infrastructure is generally ephemeral for the lifetime of a single the flow run.
For example:
• A ProcessWorker creates a process for a given flow run to execute on
• A DockerWorker create and starts a container for a given flow run to execute on
• A KubernetesWorker creates and starts an KubernetesJob for the given flow run. etc.
WorkPools are typed to match Workers. So a ProcessWorker can only detect flow runs from a Process Work Pool etc. Every Deployment schedules runs to run through a specific work pool.Jake Kaplan
09/14/2023, 8:24 PMpull_step
from your Deployment. This can include both:
• pulling down your flow code from git
• installing extra dependenciesAndy Warren
09/14/2023, 8:28 PMJake Kaplan
09/14/2023, 8:34 PMAndy Warren
09/14/2023, 8:36 PMJake Kaplan
09/14/2023, 8:37 PMAndy Warren
09/14/2023, 8:39 PMJake Kaplan
09/14/2023, 8:47 PMpull_steps
to get your code onto your containers (as opposed to a Deployment.storage_block
)
When your flow run begins execution on the container it:
• looks up the deployment for that flow run
• executes the pull_steps
on that deployment (like pulling down your code and installing dependencies)
• loads and executes your code for that flow runJake Kaplan
09/14/2023, 8:48 PMJake Kaplan
09/14/2023, 8:48 PMJake Kaplan
09/14/2023, 8:49 PMpull_steps
is in your prefect.yaml
and then calling prefect deploy
to update your deployment. if it's the same name or a saved configuration it should overwriteAndy Warren
09/14/2023, 8:51 PMJake Kaplan
09/14/2023, 8:51 PMAndy Warren
09/14/2023, 8:52 PMAndy Warren
09/14/2023, 8:53 PMJake Kaplan
09/14/2023, 8:55 PMAndy Warren
09/14/2023, 8:57 PMprefect deployment build
is runAndy Warren
09/14/2023, 8:58 PMprefect deployment apply
(if I remember correctly)Jake Kaplan
09/14/2023, 9:04 PMprefect deployment build/apply
are part of the legacy workflow I was describing aboveJake Kaplan
09/14/2023, 9:04 PMprefect deploy
Jake Kaplan
09/14/2023, 9:05 PMdeployment.yaml
. prefect.yaml
is only for saved/streamlined configurations for prefect deploy
Jake Kaplan
09/14/2023, 9:05 PMprefect deploy
CLI experience, and then saving the configuration at the endJake Kaplan
09/14/2023, 9:06 PMAndy Warren
09/14/2023, 9:06 PMAndy Warren
09/14/2023, 9:07 PMAndy Warren
09/14/2023, 9:08 PMprefect deploy
experience a go, and we’ll see where I end up. Thanks a million, really appreciate you taking the time to help me with this!Jake Kaplan
09/14/2023, 9:10 PMNate
09/14/2023, 9:19 PMMarvin
09/14/2023, 9:19 PMAndy Warren
09/14/2023, 9:32 PMprefect deploy
process. Man, what a difference, made things a bazillion times easier.Andy Warren
09/15/2023, 12:51 PMAndy Warren
09/15/2023, 12:51 PMJake Kaplan
09/15/2023, 12:53 PMpull_steps
to install the requirements.txt in your cloned repo.
https://docs.prefect.io/latest/guides/prefect-deploy/#utility-steps (scroll down slightly to get to pip_install_requirements
)
e.x. from above:
pull:
- prefect.deployments.steps.git_clone:
id: clone-step
repository: <https://github.com/org/repo.git>
- prefect.deployments.steps.pip_install_requirements:
directory: {{ clone-step.directory }}
requirements_file: requirements.txt
stream_output: False
Jake Kaplan
09/15/2023, 12:55 PMAndy Warren
09/15/2023, 12:56 PMAndy Warren
09/15/2023, 12:57 PMprefect deploy
it did not create a <deployment_name>.yaml file, only a prefect.yaml file. So where do I add these pull_steps
?Jake Kaplan
09/15/2023, 1:01 PMprefect.yaml
you should see a pull
section that you can modifyJake Kaplan
09/15/2023, 1:01 PMJake Kaplan
09/15/2023, 1:07 PMprefect deploy
your pull steps will be applied to your deployment.Andy Warren
09/15/2023, 1:57 PMprefect deploy
to create the deployment again? If so, I’m assuming I should delete the existing deployment then run through the prefect deploy
process again?Jake Kaplan
09/15/2023, 1:58 PMprefect deploy
You do not need to delete the deployment, it's keyed by name and will update accordingly if you give the same name for your deploymentAndy Warren
09/15/2023, 3:08 PMAndy Warren
09/15/2023, 4:45 PMJake Kaplan
09/15/2023, 5:41 PMstream_output=True
?Andy Warren
09/15/2023, 5:42 PMJeff Hale
09/18/2023, 4:17 PMAndy Warren
09/18/2023, 7:21 PM