-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logging endpoint #41
base: master
Are you sure you want to change the base?
Conversation
@@ -13,8 +13,6 @@ ADMIN_PASS=admin | |||
# DATA_DIR=/home/nilsnolde/dev/gis-ops/routing-graph-packager/data | |||
VALHALLA_URL="http://app" | |||
|
|||
VALHALLA_IMAGE=gisops/valhalla:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
superfluous
@@ -1,12 +1,7 @@ | |||
repos: | |||
- repo: https://github.com/ambv/black |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use ruff for linting and formatting
FROM ghcr.io/valhalla/valhalla:latest as builder | ||
LABEL [email protected] | ||
FROM ghcr.io/valhalla/valhalla:latest AS builder | ||
LABEL maintainer="Nils Nolde <[email protected]>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old format was deprecated
python-is-python3 \ | ||
python3-pip \ | ||
python3-venv \ | ||
curl > /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also contains the ubuntu 24.04 lts update
|
||
ENV POETRY_BIN /root/.local/bin/poetry | ||
ENV POETRY_BIN=/root/.local/bin/poetry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old format was deprecated
@@ -15,17 +15,14 @@ | |||
from routing_packager_app import SETTINGS | |||
from routing_packager_app.db import get_db | |||
from routing_packager_app.api_v1.models import Job, User | |||
from routing_packager_app.logger import AppSmtpHandler, get_smtp_details | |||
from routing_packager_app.logger import AppSmtpHandler, get_smtp_details, LOGGER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consistent use of the logger throughout the app
@@ -1,3 +1,6 @@ | |||
from routing_packager_app.logger import LOGGING_CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice: gunicorn allows us to pass a custom logging config!
@@ -24,7 +24,7 @@ async def lifespan(app: FastAPI): | |||
p.mkdir(exist_ok=True) | |||
SETTINGS.get_output_path().mkdir(exist_ok=True) | |||
yield | |||
app.state.redis_pool.shutdown() | |||
await app.state.redis_pool.shutdown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was causing a warning
|
||
from fastapi.security import HTTPBasicCredentials | ||
from geoalchemy2 import Geography | ||
from pydantic import EmailStr | ||
from sqlalchemy import Column | ||
from sqlalchemy_utils import PasswordType | ||
from sqlmodel import SQLModel, Field, DateTime, Relationship, Session, select, AutoString | ||
from sqlmodel import AutoString, DateTime, Field, Relationship, Session, SQLModel, select |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ruff also does isort's job now
@@ -79,6 +79,19 @@ def get_tmp_data_dir(self) -> Path: | |||
|
|||
return tmp_data_dir | |||
|
|||
def get_logging_dir(self) -> Path: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally all logs are written into the tmp_data_dir
logs subdirectory, so they are easily shared with the FastAPI app.
@@ -31,7 +35,7 @@ wait_for_lock() { | |||
count=$(( $count + $sleep )) | |||
done | |||
|
|||
echo "ERROR: max count reached" | |||
log_message "ERROR: max count reached" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attach origin and date time to message for better logs
Adds a new end point to the REST API (
/api/v1/logs/{log_type}
, available log types areapp
,worker
andbuilder
). Unfortunately, supervisor can not be configured with a custom logger, which would enable us to have consistent behavior across the stack.