https://prefect.io logo
#prefect-community
Title
# prefect-community
w

William Wagner

05/09/2022, 4:54 PM
Hi, a bit new here so forgive me if this is a bit rudimentary, but I was reading https://www.prefect.io/blog/introducing-prefect-2-0/ and the following stuck out: "_Prefect 2.0 introduces an ephemeral API that lets it deliver a full orchestration suite even when you haven’t spun up an Orion server, database, agent, or UI._" I am a bit confused how that works internally and have a couple questions if you don't mind: 1. If I execute a flow locally in process (e.g.
___main___
), is there an in-process Orion orchestrator running alongside it? 2. If 1), is the flow meta-data persisted in a local SQLite instance on disk? 3. Is this "ephemeral" server-less workflow intended for purely testing purposes, or is it production viable?
k

Kevin Kho

05/09/2022, 4:57 PM
When you run something like this:
Copy code
from prefect import flow, task
from typing import List
import httpx

@task(retries=3)
def get_stars(repo: str):
    url = f"<https://api.github.com/repos/{repo}>"
    count = httpx.get(url).json()["stargazers_count"]
    print(f"{repo} has {count} stars!")


@flow(name="Github Stars")
def github_stars(repos: List[str]):
    for repo in repos:
        get_stars(repo)

# run the flow!
github_stars(["PrefectHQ/Prefect", "PrefectHQ/miter-design"])
The state is persisted in the SQLite database through the ephemeral API even if you haven’t started the Orion service. I believe it can be production viable and you can bring your own scheduler like Cron even, but at some point, you need to spin up the service to view in the UI so I think it’s really more for testing without the service
w

William Wagner

05/09/2022, 5:00 PM
Ah Kevin, that clarifies it a bit. If you don't mind, do you effectively point the Orion server to the SQLite database location, and it can automagically load that and display Flow/Task run details?
k

Kevin Kho

05/09/2022, 5:04 PM
Yes, and then you can just point it to cloud if you want to use Prefect Cloud 2.0 instead. You point to the API specifically
6 Views