Prathamesh Chavan
03/07/2024, 10:06 AMRunner
webserver released in version 2.14.17,
but wasn't able to get the runner setup working. In the community, I could see others already using it and hence, wanted to know what I was doing wrong.Prathamesh Chavan
03/07/2024, 10:07 AM3.10.13
. and has been running httpx: version 0.26Prathamesh Chavan
03/07/2024, 10:12 AM_submit_flow_to_runner
prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<<http://localhost:8080/flow/run>>'
suggesting that there is some issue in the client received by _submit_flow_to_runner
by calling get_client() as it is unable to call the url <http://localhost:8080/flow/run>
Prathamesh Chavan
03/07/2024, 10:12 AMDaryl
03/12/2024, 4:16 PMDaryl
03/12/2024, 4:17 PMDaryl
03/12/2024, 4:17 PMPrathamesh Chavan
03/13/2024, 6:25 PMprefect server start
Mostly all of the settings are default, apart from setting PREFECT_EXPERIMENTAL_ENABLE_EXTRA_RUNNER_ENDPOINTS
and PREFECT_RUNNER_SERVER_ENABLE
to truePrathamesh Chavan
03/13/2024, 6:27 PMDaryl
03/14/2024, 3:50 PMdocker-compose
which uses the standard prefect docker images. Note it's got extra pips installed for my particular use case in astronomy and w sqlalchmey.
If you don't want to bother with the postgres install commnet out the db
stanza and comment out the postgres PREFECT_API_DATABASE_CONNECTION_URL
and uncommnet the one below it for sqlite.
Note that you will need a .env
file in the project root if you use the poastgres to set the variables for user, pass, and db.
Iif you're just getting started it's probablyt better to use the sqlite to simlpify things.).
You'll also prolly have to comment out the /data/staging
volumes as well unless you want to do local file operations etc.
version: "3.9"
services:
server:
image: prefecthq/prefect:2.16.3-python3.11
restart: always
volumes:
- prefect:/root/.prefect
- /data/staging:/data/staging
entrypoint: ["/bin/bash", "-c"]
environment:
# - PREFECT_SERVER_API_HOST=0.0.0.0
- PREFECT_SERVER_API_HOST=127.0.0.1
- PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}
# - PREFECT_API_DATABASE_CONNECTION_URL=sqlite+aiosqlite:////root/.prefect/prefect.db
- EXTRA_PIP_PACKAGES=astropy prefect-sqlalchemy psycopg2-binary datetime httpx
command: ["prefect server start --host 0.0.0.0"]
ports:
- "4200:4200"
worker:
image: prefecthq/prefect:2.16.3-python3.11
restart: always
volumes:
- .:/app
- /data/staging:/data/staging
working_dir: /app
command: ["sh", "-c", "sleep 3 && python pipeline.py"]
environment:
- PREFECT_API_URL=<http://server:4200/api>
- PREFECT_EXPERIMENTAL_ENABLE_EXTRA_RUNNER_ENDPOINTS=True
- PREFECT_RUNNER_SERVER_HOST=127.0.0.1
- EXTRA_PIP_PACKAGES=astropy prefect-sqlalchemy psycopg2-binary datetime httpx
depends_on:
- server
ports:
- "8080:8080"
db:
image: postgres:15.4-alpine
container_name: prefect-db
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- db:/var/lib/postgresql/data
# - /container-volumes/pg-volume:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
prefect:
db:
networks:
prefect-network:
driver: bridge
This docker definitely works both locally and in production and is running my concurrent flows on the runner (tho has some sort of issues that may be my code or may be the runner. Still figuring it out.
Good luck !Prathamesh Chavan
03/17/2024, 10:44 AM