In prefect 2.0, whats the alternative command of `...
# prefect-community
h
In prefect 2.0, whats the alternative command of
Copy code
$ prefect backend server
1
t
prefect orion start
will allow you to achieve orchestration locally and give you access to a UI without needing Prefect cloud.
1
r
@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
@Robert Bastian I can confirm it for you, since I just did it. You don't. 🙂
🦜 1
gratitude thank you 1
r
@Oscar Björhn - Weird, without Orion Server running I get this error locally:
Copy code
RuntimeError: Cannot create flow run. Failed to reach API at <http://127.0.0.1:4200/api/>.
t
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
@Taylor Curran Even just running the python script - e.g. “python flow.py” I still get the same error. Here is my “flow”:
Copy code
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.
Copy code
PREFECT_API_URL=
gratitude thank you 1
t
Sorry @Robert Bastian, what was the error again?
m
@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.