Jons Cyriac
12/10/2021, 12:28 PMimage: prefecthq/apollo
image: prefecthq/server:core-0.15.10
image: hasura/graphql-engine:v2.1.0-beta.3.arm64
image: postgres:11
image: prefecthq/server
image: prefecthq/ui
(I was ablt to get the hasura engine run only using this arm64 image.)Anna Geller
12/10/2021, 12:31 PMJons Cyriac
12/10/2021, 12:32 PMprefect server backend
and started local agent using prefect agent local start --name "Default Agent
after doing docker compose up
Anna Geller
12/10/2021, 12:37 PMJons Cyriac
12/10/2021, 12:41 PMimport prefect
from prefect import task, Flow
from prefect.storage import Local
@task
def say_hello():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("Hello, Cloud!")
with Flow("hello-flow", storage=Local()) as flow:
say_hello()
storage=Local()
# Register the flow under the "tutorial" project
flow.register(project_name="tutorial")
flow.storage.build()
flow.run()
Anna Geller
12/10/2021, 12:45 PMprefect run --name yourflowname --project yourproject --watch
then you’ll see it in the UI because it runs with a backendError: HTTPConnectionPool(host='hasura', port=3000): Max retries exceeded with url: /v1/query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc34448fa10>: Failed to establish a new connection: [Errno 111] Connection refused'))
Could not upgrade the database!
Running Alembic migrations...
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Error: HTTPConnectionPool(host='hasura', port=3000): Max retries exceeded with url: /v1/query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89b51e86d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
I would recommend using the approach from the docs:
prefect backend server
prefect server start
# in a new terminal window
prefect agent local start --label yourlabel
This should work well. If you need any custom addition to it, have a look at all the override options provided by the CLI:
prefect server config --help
flow.register(build=True)
is the default
#2 Ideally, you should not keep flow.register(project_name="tutorial")
in your flow file. It’s easier to use CLI for this:
prefect register --project xyz -p yourflow.py
Jons Cyriac
12/10/2021, 1:42 PMAnna Geller
12/10/2021, 1:43 PMJons Cyriac
12/10/2021, 1:45 PMAnna Geller
12/10/2021, 1:47 PMJons Cyriac
12/10/2021, 1:50 PMAnna Geller
12/10/2021, 1:50 PMJons Cyriac
12/10/2021, 1:53 PMAnna Geller
12/10/2021, 2:00 PMJons Cyriac
12/10/2021, 2:24 PM