https://prefect.io logo
Title
h

Hafsa Junaid

08/01/2022, 4:24 PM
In prefect 2.0, whats the alternative command of
$ prefect backend server
1
t

Taylor Curran

08/01/2022, 4:26 PM
prefect orion start
will allow you to achieve orchestration locally and give you access to a UI without needing Prefect cloud.
1
r

Robert Bastian

08/01/2022, 5:29 PM
@Taylor Curran Can you confirm that you must have a server running (even locally) to run flows? The documentation implies that you don’t and I just wanted to check. Thx!
o

Oscar Björhn

08/01/2022, 6:00 PM
@Robert Bastian I can confirm it for you, since I just did it. You don't. 🙂
:party-parrot: 1
:gratitude-thank-you: 1
r

Robert Bastian

08/02/2022, 1:06 PM
@Oscar Björhn - Weird, without Orion Server running I get this error locally:
RuntimeError: Cannot create flow run. Failed to reach API at <http://127.0.0.1:4200/api/>.
t

Taylor Curran

08/02/2022, 1:13 PM
The Orion server needs to be running for flows to be orchestrated. You can “run flows” locally sans orion by running the python file, though this is not a true flow run.
👍 1
r

Robert Bastian

08/02/2022, 2:53 PM
@Taylor Curran Even just running the python script - e.g. “python flow.py” I still get the same error. Here is my “flow”:
import requests
from prefect import flow

@flow(name="test")
def call_api(url:str):
    return requests.get(url).json()

api_result = call_api("<http://time.jsontest.com/>")
print(api_result)
In case anybody else stumbles on this I had to set an env var to NULL to enable the ephemeral API.
PREFECT_API_URL=
:gratitude-thank-you: 1
t

Taylor Curran

08/12/2022, 3:08 PM
Sorry @Robert Bastian, what was the error again?
m

Mars

08/16/2022, 11:13 PM
@Taylor Curran the script says there is an error communicating with the API server. And if you run
prefect version
you can see the server type is
hosted
, not
ephemeral
. I had to use the workaround of explicitly clearing the
PREFECT_API_URL=
variable before calling the
prefect
program in order to switch back to the ephemeral API.