Tarek
08/09/2022, 4:02 PMTarek
08/09/2022, 4:03 PM15:59:11.628 | INFO | prefect.engine - Created flow run 'huge-lorikeet' for flow 'my_test_endpoint'
15:59:11.628 | INFO | Flow run 'huge-lorikeet' - Starting 'ConcurrentTaskRunner'; submitted tasks will be run concurrently...
15:59:11.695 | ERROR | Flow run 'huge-lorikeet' - Crash detected! Execution was interrupted by an unexpected exception.
15:59:11.728 | ERROR | root - TypeError
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
await <http://self.app|self.app>(scope, receive, _send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 68, in __call__
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.8/site-packages/starlette_context/middleware/context_middleware.py", line 70, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 46, in call_next
raise app_exc
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 36, in coro
await <http://self.app|self.app>(scope, request.receive, send_stream.send)
File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 93, in __call__
raise exc
File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
await <http://self.app|self.app>(scope, receive, sender)
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await <http://self.app|self.app>(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 670, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 266, in handle
await <http://self.app|self.app>(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 65, in app
response = await func(request)
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 227, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 162, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await <http://anyio.to|anyio.to>_thread.run_sync(func, *args)
File "/usr/local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.8/site-packages/prefect/flows.py", line 390, in __call__
return enter_flow_run_engine_from_flow_call(
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 152, in enter_flow_run_engine_from_flow_call
return anyio.run(begin_run)
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "/usr/local/lib/python3.8/site-packages/prefect/client.py", line 104, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 221, in create_then_begin_flow_run
state = await begin_flow_run(
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 333, in begin_flow_run
await result_filesystem._save(is_anonymous=True)
File "/usr/local/lib/python3.8/site-packages/prefect/blocks/core.py", line 618, in _save
await self.register_type_and_schema(client=client)
TypeError: object NoneType can't be used in 'await' expression
15:59:11.733 | ERROR | uvicorn.error - Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await <http://self.app|self.app>(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 269, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 124, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
await <http://self.app|self.app>(scope, receive, _send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 68, in __call__
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.8/site-packages/starlette_context/middleware/context_middleware.py", line 70, in dispatch
response = await call_next(request)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 46, in call_next
raise app_exc
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/base.py", line 36, in coro
await <http://self.app|self.app>(scope, request.receive, send_stream.send)
File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 93, in __call__
raise exc
File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
await <http://self.app|self.app>(scope, receive, sender)
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await <http://self.app|self.app>(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 670, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 266, in handle
await <http://self.app|self.app>(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 65, in app
response = await func(request)
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 227, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 162, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await <http://anyio.to|anyio.to>_thread.run_sync(func, *args)
File "/usr/local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.8/site-packages/prefect/flows.py", line 390, in __call__
return enter_flow_run_engine_from_flow_call(
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 152, in enter_flow_run_engine_from_flow_call
return anyio.run(begin_run)
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "/usr/local/lib/python3.8/site-packages/prefect/client.py", line 104, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 221, in create_then_begin_flow_run
state = await begin_flow_run(
File "/usr/local/lib/python3.8/site-packages/prefect/engine.py", line 333, in begin_flow_run
await result_filesystem._save(is_anonymous=True)
File "/usr/local/lib/python3.8/site-packages/prefect/blocks/core.py", line 618, in _save
await self.register_type_and_schema(client=client)
TypeError: object NoneType can't be used in 'await' expression
Khuyen Tran
08/09/2022, 4:03 PMTarek
08/09/2022, 4:03 PM@task(name="get_name")
def get_name():
return "world"
@task(name="hello_name")
def hello_name(name):
print("hello " + name)
return "hello " + name
@flow(name="call_name")
def call_name():
name = get_name()
print("the name is: " + name) # 2
return name
@router.get('/test')
def get_test_endpoint():
res = call_name()
return "test"
Tarek
08/09/2022, 4:05 PMKhuyen Tran
08/09/2022, 4:06 PMget_test_endpoint
is not a flow. Is that correct?Tarek
08/09/2022, 4:06 PMKhuyen Tran
08/09/2022, 4:07 PMcall_name
by itself and see if you get the error?Tarek
08/09/2022, 4:08 PMTarek
08/09/2022, 4:11 PMKhuyen Tran
08/09/2022, 4:13 PMTarek
08/09/2022, 4:15 PMres = call_name()
print(res)
the output is world
..correctKhuyen Tran
08/09/2022, 4:19 PM.submit
to the task call within your flow and see if you see the same error?
@flow(name="call_name")
def call_name():
name = get_name.submit()
return name
Mason Menges
08/09/2022, 4:19 PMKhuyen Tran
08/09/2022, 4:20 PMTarek
08/09/2022, 4:23 PMTarek
08/09/2022, 4:24 PMFile "/usr/local/lib/python3.8/site-packages/prefect/blocks/core.py", line 618, in _save
TypeError: object NoneType can't be used in 'await' expression
do i need a block object in the UI? i dont think soMason Menges
08/09/2022, 4:27 PMprefect orion database reset -y
Tarek
08/09/2022, 4:33 PMMason Menges
08/09/2022, 4:35 PMTarek
08/09/2022, 4:35 PMTarek
08/10/2022, 6:58 AMfrom prefect import flow, task
@task(name="get_name")
def get_name():
return "world"
@flow(name="call_name")
def call_name():
name = get_name()
print("the name is: " + name)
return name
from fastapi import APIRouter
router = APIRouter(redirect_slashes=False)
@router.get('/test')
def get_test_endpoint():
return call_name()
@router.get('/ok')
def get_ok():
return "ok"
import uvicorn
if __name__ == "__main__":
uvicorn.run(router, host="0.0.0.0", port=8000)
Tarek
08/10/2022, 6:58 AMTarek
08/10/2022, 7:00 AMTarek
08/10/2022, 11:55 AMAnna Geller
Anna Geller
Anna Geller
Tarek
08/10/2022, 1:03 PMAnna Geller
Marvin
08/10/2022, 1:05 PMTarek
08/10/2022, 1:06 PMTarek
08/15/2022, 9:34 AMAnna Geller
Tarek
08/17/2022, 3:11 PMgit push --set-upstream origin fix_running_a_flow_from_fastapi
remote: Permission to PrefectHQ/prefect.git denied to
...Anna Geller
Anna Geller