Brad
03/15/2022, 9:04 PMSet 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.
Anna Geller
03/15/2022, 9:15 PMpip install -U "prefect==2.0b1"
And then running a simple hello world flow like this?
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()
prefect orion database reset -y
prefect version
command which is incredibly slick - shoutout to @Zanie for that πDarshan
03/15/2022, 9:25 PMAnna Geller
03/15/2022, 9:26 PMDarshan
03/15/2022, 9:26 PMAnna Geller
03/15/2022, 9:26 PMDarshan
03/15/2022, 9:27 PMBrad
03/15/2022, 9:29 PMpipx
in a clean envβ― 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.
Anna Geller
03/15/2022, 9:30 PMBrad
03/15/2022, 9:30 PMAnna Geller
03/15/2022, 9:31 PMBrad
03/15/2022, 9:31 PMAnna Geller
03/15/2022, 9:31 PMBrad
03/15/2022, 9:31 PMAnna Geller
03/15/2022, 9:32 PMZanie
03/15/2022, 9:32 PMAnna Geller
03/15/2022, 9:32 PMZanie
03/15/2022, 9:32 PMBrad
03/15/2022, 9:33 PMjustabill
03/15/2022, 9:34 PMZanie
03/15/2022, 9:42 PMindex 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:
Brad
03/15/2022, 10:00 PMZanie
03/17/2022, 8:54 PM