Gintas
02/08/2024, 9:02 PMNate
02/08/2024, 9:06 PMNate
02/08/2024, 9:07 PMGintas
02/09/2024, 8:41 AMNate
02/09/2024, 2:31 PMGintas
02/09/2024, 5:44 PMNate
02/09/2024, 5:54 PMMarvin
02/09/2024, 5:55 PMprefect worker start --pool <work-pool-name>
.
- Worker must correspond to an appropriate work pool.
- Tutorial available here.
Infrastructure-Level Overrides:
- Customize infrastructure blocks through UI, Prefect Cloud Blocks page, or in code.
- Infrastructure blocks can be Docker, Kubernetes, ECS Task, Cloud Run, etc.
- Use -i
or --infra
to set defaults. Use -ib
or --infra-block
with block slug for pre-configured settings.
- Example command to build deployment: prefect deployment build ./my_flow.py:my_flow -n my-flow-deployment -t test -i docker-container -sb s3/my-bucket --override env.EXTRA_PIP_PACKAGES=s3
- More on configuration here and recent update here.Nate
02/09/2024, 5:56 PMprefect deployment build
is effectively deprecated, use prefect deploy
with prefect.yaml
insteadMarvin
02/09/2024, 5:57 PMprefect deploy
in combination with prefect.yaml
for orchestrating deployments.
- prefect.yaml
configures deployment settings, including infrastructure overrides.
- Custom infrastructure settings are defined as blocks, which can be reused in deployments.
- The new approach encourages version-controlled and reusable configurations.
You'll find the paradigm shift towards prefect deploy
promotes better CI/CD practices and configuration management. The Prefect docs and change logs are valuable resources for grasping the nuances of these newer patterns.Nate
02/09/2024, 5:59 PMGintas
02/09/2024, 6:14 PMNate
02/09/2024, 6:14 PMNate
02/09/2024, 6:15 PMGintas
02/09/2024, 6:15 PMGintas
02/09/2024, 6:16 PMNate
02/09/2024, 6:17 PM.deploy(name="my-gpu-deployment", work_pool_name="my-gpu-infra"...)
on) and then in your python code you'd trigger a run on that deployments infra with run_deployment("my-decorated-fn/my-gpu-deployment")
but you'd need a work pool to represent your GPU infra to send your deployment's flow runs toNate
02/09/2024, 6:19 PMGintas
02/09/2024, 6:20 PMNate
02/09/2024, 6:20 PMGintas
02/09/2024, 6:20 PMNate
02/09/2024, 6:27 PM.serve
from prefect import flow, task
@task
def work(x):
print(f"got {x}")
@flow(log_prints=True)
def collection_of_work():
for i in range(10):
work(i)
# or work.map(range(10)) to do above concurrently
# starts a long lived process
collection_of_work.serve("my-deployment-name")
so you could write / serve a flow on any of your computers and then trigger it from anywhere