https://prefect.io logo
Title
b

Ben Muller

10/31/2022, 10:33 PM
Hi Community - unbelievably dumb question for 2.0. I am a 1.0 user and trying to play around with 2.0. Have set up a basic hello world flow and trying to run the flow locally with the 2.0 equivalent of
prefect run -p test_flow.py
Is this an option in 2.0 on the cli? or do I have to initate through python every time?
1
r

Ryan Peden

10/31/2022, 10:42 PM
Not a dumb question 🙂 If you just want to run it locally, you just run it using
python
. I believe the Prefect 1 CLI's
run
command could also pull a flow from storage and run it and for that,
prefect deployment run
is somewhat similar.
:upvote: 2
b

Ben Muller

10/31/2022, 10:45 PM
Cheers @Ryan Peden I dont think
run
pulls anything from storage - it just executes locally. ( in 1.0 ) I am surprised we can not run flows locally from the cli in 2.0 😢
n

Nate

10/31/2022, 10:50 PM
you can run flows locally, you'll notice that if you do
python my_flow.py
(and are connected to your cloud workspace) and run the flow locally, it'll still show in the UI and in prefect 1, running
prefect run
still pulls from storage, but if you didn't configure storage, it defaulted to LocalStorage so it didn't feel like it was pulling from anywhere
b

Ben Muller

10/31/2022, 10:51 PM
in prefect 1.0 I did have storage ( DockerStorage ) in ecs. But it would run the code that I have locally, and run it in the cli
n

Nate

10/31/2022, 10:54 PM
gotcha, in 2.0 you can just do
python my_flow.py
and that should serve the same needs as
prefect run
in 1.0
b

Ben Muller

10/31/2022, 10:55 PM
yes, but that means I always have to have an `if name == main block, yeah?
n

Nate

10/31/2022, 10:57 PM
personally I did that in 1.0 as well, but yeah I suppose that's true
b

Ben Muller

10/31/2022, 10:57 PM
oh, I never did that
ok thanks
While I have you, I am trying to run this example flow in the docs :
from prefect import flow


@flow
def my_favorite_function():
    print("What is your favorite number?")
    return 42


print(my_favorite_function())
I am hit with the following error
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: slug
[SQL: ALTER TABLE block_type ADD COLUMN slug VARCHAR]
(Background on this error at: <https://sqlalche.me/e/14/e3q8>)
Want the full traceback?
n

Nate

10/31/2022, 10:58 PM
ahh try
rm -rf ~/.prefect/orion.db && prefect orion database reset -y
b

Ben Muller

10/31/2022, 10:58 PM
I am running in a conda env, so not sure why this is happening
n

Nate

10/31/2022, 10:58 PM
provided you're on some unix system
b

Ben Muller

10/31/2022, 10:58 PM
on Mac
that did the job
👍 1
🙏