Starting agent with ephemeral API...
___ ___ ___ ___ ___ ___ _____ _ ___ ___ _ _ _____
| _ \ _ \ __| __| __/ __|_ _| /_\ / __| __| \| |_ _|
| _/ / _|| _|| _| (__ | | / _ \ (_ | _|| .` | | |
|_| |_|_\___|_| |___\___| |_| /_/ \_\___|___|_|\_| |_|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Sets Prezto options. | |
# | |
# Authors: | |
# Sorin Ionescu <sorin.ionescu@gmail.com> | |
# | |
# | |
# General | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from prefect import flow | |
@flow(log_prints=True) | |
def fetch_weather(lat: float = 38.9, lon: float = -77.0): | |
weather = requests.get( | |
"https://api.open-meteo.com/v1/forecast/", | |
params=dict(latitude=lat, longitude=lon, hourly="temperature_2m"), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from demo import pipeline2 | |
from prefect.deployments import Deployment | |
from prefect.filesystems import S3 | |
from prefect.orion.schemas.schedules import IntervalSchedule | |
deployment2 = Deployment.build_from_flow( | |
flow=pipeline2, | |
name="Second Python Deployment Example", | |
schedule=(IntervalSchedule(interval=60)), | |
tags=["extract"], |
Usage: prefect deployment build [OPTIONS] PATH
Generate a deployment YAML from /path/to/file.py:flow_function
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────╮
│ * path TEXT The path to a flow entrypoint, in the form of │
│ `./path/to/file.py:flow_func_name` │
│ [default: None] │
│ [required] │
(base) jeffhale prefect/demo [main] $ prefect --help
Usage: prefect [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────╮
│ --version -v Display the current version. │
│ --profile -p TEXT Select a profile for this this CLI run. [default: None] │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from demo import pipeline | |
from prefect.deployments import Deployment | |
deployment = Deployment.build_from_flow( | |
flow=pipeline, | |
name="Python Deployment Example", | |
) | |
if __name__ == "__main__": | |
deployment.apply() |
prefect deployment build demo.py:pipeline -n cool-deployment --apply
prefect deployment build demo.py:pipeline -n cool-deployment
prefect deployment apply pipeline-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
import yfinance as yf | |
from datetime import timedelta | |
from prefect import flow, task | |
@task(retries=3, cache_expiration=timedelta(30)) | |
def fetch_data(ticker): | |
return yf.download(ticker) | |
@task |
NewerOlder