Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow code storage docs improvements #15519

Merged
merged 26 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/3.0/deploy/infrastructure-concepts/customize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Override job variables
description: Learn how to override job variables on a work pool for a given deployment.
---

There are two ways to deploy flows to work pools: using a `prefect.yaml` file or using the `.deploy()` method.
There are two ways to deploy flows to work pools: with a []`prefect.yaml` file]() or using the Python`deploy` method.
discdiver marked this conversation as resolved.
Show resolved Hide resolved
In both cases, you can override job variables on a work pool for a given deployment.

This guide explores common patterns for overriding job variables in
Expand Down
19 changes: 19 additions & 0 deletions docs/3.0/deploy/infrastructure-concepts/deploy-via-python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ To deploy a flow using `flow.deploy` and Docker, follow these steps:
```python example.py
from prefect import flow


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")
Expand All @@ -75,10 +76,12 @@ To deploy a flow using `flow.deploy` and Docker, follow these steps:
```python example.py
from prefect import flow


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand Down Expand Up @@ -145,10 +148,12 @@ To deploy a flow with a schedule, you can use one of the following options:
from datetime import timedelta
from prefect import flow


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand All @@ -168,10 +173,12 @@ To deploy a flow with a schedule, you can use one of the following options:
```python cron.py
from prefect import flow


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand All @@ -192,10 +199,12 @@ To deploy a flow with a schedule, you can use one of the following options:
```python rrule.py
from prefect import flow


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand All @@ -221,10 +230,12 @@ To deploy a flow with a schedule, you can use one of the following options:
from prefect import flow
from prefect.client.schemas.schedules import IntervalSchedule


@flow(log_prints=True)
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand Down Expand Up @@ -271,6 +282,7 @@ Here's an example of loading a flow from a Git repository and deploying it:
```python git-deploy.py
from prefect import flow


if __name__ == "__main__":
flow.from_source(
source="https://github.com/username/repository.git",
Expand Down Expand Up @@ -299,10 +311,12 @@ You can set default parameters for a deployment using the `parameters` keyword a
```python default-parameters.py
from prefect import flow


@flow
def my_flow(name: str = "world"):
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand All @@ -325,11 +339,13 @@ The job variables provided will override the values set on the work pool.
import os
from prefect import flow


@flow
def my_flow():
name = os.getenv("NAME", "world")
print(f"Hello, {name}!")


if __name__ == "__main__":
my_flow.deploy(
name="my-deployment",
Expand All @@ -354,14 +370,17 @@ If you want to deploy multiple flows at once, use the `deploy` function.
```python multi-deploy.py
from prefect import flow, deploy


@flow
def my_flow_1():
print("I'm number one!")


@flow
def my_flow_2():
print("Always second...")


if __name__ == "__main__":
deploy(
# Use the `to_deployment` method to specify configuration
Expand Down
Loading
Loading