Hi Community - unbelievably dumb question for 2.0....
# prefect-community
b
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
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
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
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
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
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
yes, but that means I always have to have an `if name == main block, yeah?
n
personally I did that in 1.0 as well, but yeah I suppose that's true
b
oh, I never did that
ok thanks
While I have you, I am trying to run this example flow in the docs :
Copy code
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
Copy code
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
ahh try
Copy code
rm -rf ~/.prefect/orion.db && prefect orion database reset -y
b
I am running in a conda env, so not sure why this is happening
n
provided you're on some unix system
b
on Mac
that did the job
👍 1
🙏