hey team - orion 2.0b1 is throwing some typer erro...
# prefect-community
b
hey team - orion 2.0b1 is throwing some typer errors on success (I can see they are succeeding but it looks potentially misleading)
Copy code
Set default storage to 'local'.
Traceback (most recent call last):
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/base.py", line 58, in wrapper
    return fn(*args, **kwargs)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 120, in wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 67, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 56, in run
    return asynclib.run(func, *args, **backend_options)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 233, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 228, in wrapper
    return await func(*args)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/storage.py", line 136, in create
    exit_with_success(f"Set default storage to {name!r}.")
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/base.py", line 193, in exit_with_success
    raise typer.Exit(0)
click.exceptions.Exit: 0
An exception occurred.
πŸ™ 3
a
How did you install it? I couldn't reproduce the issue.
Can you try reinstalling using:
Copy code
pip install -U "prefect==2.0b1"
And then running a simple hello world flow like this?
Copy code
from prefect import task, flow
from prefect import get_run_logger


@task
def say_hi():
    logger = get_run_logger()
    <http://logger.info|logger.info>("Hello world!")


@flow
def hello_world():
    say_hi()


from prefect.deployments import DeploymentSpec

DeploymentSpec(
    name="hello_world_dev",
    flow=hello_world,
    flow_location="/Users/anna/repos/gitops-orion-flows/flows/hello_world.py",
)

if __name__ == "__main__":
    flow_run_state = hello_world()
and if nothing else works, you can remove or reset the database:
Copy code
prefect orion database reset -y
Also - you can now help us reproduce your issue by sharing the output of the
prefect version
command which is incredibly slick - shoutout to @Zanie for that πŸ™‚
d
πŸ™ 1
a
thx for reporting that πŸ™
d
https://orion-docs.prefect.io/collections/overview/ this one seems to be working fine
a
without the .md
d
Yep, may be updating the link in slack messages and discourse will be helpful for others
πŸ‘ 2
βœ… 1
b
Hey @Anna Geller I have prefect install with
pipx
in a clean env
Copy code
❯ pipx install prefect==2.0b1                                                                                                                                                                                                                                                                                                       08:29:38
  installed package prefect 2.0b1, Python 3.9.7
  These apps are now globally available
    - prefect
done! ✨ 🌟 ✨

❯ rm ~/.prefect/orion.db                                                                                                                                                                                                                                                                                                            08:30:05

❯ prefect orion database reset                                                                                                                                                                                                                                                                                                      08:30:11
Are you sure you want to reset the Orion database located at "sqlite+aiosqlite://///home/brad/.prefect/orion.db"? This will drop and recreate all tables. [y/N]: y
Resetting Orion database...
Dropping tables...
Creating tables...
Orion database "sqlite+aiosqlite://///home/brad/.prefect/orion.db" reset!
Traceback (most recent call last):
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/base.py", line 58, in wrapper
    return fn(*args, **kwargs)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 120, in wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 67, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 56, in run
    return asynclib.run(func, *args, **backend_options)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 233, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 228, in wrapper
    return await func(*args)
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/orion.py", line 220, in reset
    exit_with_success(f'Orion database "{engine.url}" reset!')
  File "/home/brad/.local/pipx/venvs/prefect/lib/python3.9/site-packages/prefect/cli/base.py", line 193, in exit_with_success
    raise typer.Exit(0)
click.exceptions.Exit: 0
An exception occurred.
a
what about your prefect version @Brad? did you try the hello world flow - did it return the same error?
b
^ fresh install, wipe orion db
db reset gives me the same error
a
now I have to learn what is pipx πŸ˜‚
b
its basically just a clean venv for cli tools
a
can you maybe just try using normal pip like old-school people like me? haha
b
yep, let me try in a clean conda env
πŸ‘ 1
a
maybe pipx doesn't have the latest repository from pip?
z
πŸ˜„ I can reproduce this
a
πŸ˜„
z
The success exit exception is not being properly captured
There’s no real error here, just a bad message.
b
yeah copy that @Zanie - just wanted to raise typer was handling the clean exit loudly
πŸ™ 2
same issue in a clean conda env
just an FYI
j
That you for letting us know about the mis-formatted link @Darshan, I have updated it in the announcement post.
πŸ‘ 3
@Brad I've reproduced the issue you identified as well and made a note of it. I'll let you know when we ship a change to that message.
z
If you want to patch it before we cut a release:
Copy code
index 2f7a0d4c9..a1368848c 100644
--- a/src/prefect/cli/base.py
+++ b/src/prefect/cli/base.py
@@ -13,6 +13,7 @@ import pendulum
 import rich.console
 import typer
 import typer.core
+from click.exceptions import ClickException
 
 import prefect
 import prefect.context
@@ -56,6 +57,8 @@ def with_cli_exception_handling(fn):
     def wrapper(*args, **kwargs):
         try:
             return fn(*args, **kwargs)
+        except (typer.Exit, typer.Abort, ClickException):
+            raise  # Do not capture click or typer exceptions
         except MissingProfileError as exc:
             exit_with_error(exc)
         except Exception:
b
cheers!
not an issue for me - but it might be for some other users
z
This should be solved in 2.0b2