Skip to content

Commit

Permalink
Merge branch 'dev' into fix-id-get
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvanderveen authored Jun 24, 2024
2 parents d2f661f + b913afb commit 527073c
Show file tree
Hide file tree
Showing 50 changed files with 497 additions and 704 deletions.
Empty file.
59 changes: 0 additions & 59 deletions packages/grid/backend/grid/logger/config.py

This file was deleted.

108 changes: 0 additions & 108 deletions packages/grid/backend/grid/logger/handler.py

This file was deleted.

46 changes: 46 additions & 0 deletions packages/grid/backend/grid/logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 1
disable_existing_loggers: True
formatters:
default:
format: "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
uvicorn.default:
"()": uvicorn.logging.DefaultFormatter
format: "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
uvicorn.access:
"()": "uvicorn.logging.AccessFormatter"
format: "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
handlers:
default:
formatter: default
class: logging.StreamHandler
stream: ext://sys.stdout
uvicorn.default:
formatter: uvicorn.default
class: logging.StreamHandler
stream: ext://sys.stdout
uvicorn.access:
formatter: uvicorn.access
class: logging.StreamHandler
stream: ext://sys.stdout
loggers:
uvicorn.error:
level: INFO
handlers:
- uvicorn.default
propagate: no
uvicorn.access:
level: INFO
handlers:
- uvicorn.access
propagate: no
syft:
level: INFO
handlers:
- default
propagate: no
root:
level: INFO
handlers:
- default
22 changes: 14 additions & 8 deletions packages/grid/backend/grid/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# stdlib

# stdlib
from contextlib import asynccontextmanager
import logging
from typing import Any

# third party
Expand All @@ -16,7 +15,15 @@
from grid.api.router import api_router
from grid.core.config import settings
from grid.core.node import worker
from grid.logger.handler import get_log_handler


class EndpointFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
return record.getMessage().find("/api/v2/?probe=livenessProbe") == -1


logger = logging.getLogger("uvicorn.error")
logging.getLogger("uvicorn.access").addFilter(EndpointFilter())


@asynccontextmanager
Expand All @@ -25,7 +32,7 @@ async def lifespan(app: FastAPI) -> Any:
yield
finally:
worker.stop()
print("Worker Stop !!!")
logger.info("Worker Stop")


app = FastAPI(
Expand All @@ -34,7 +41,6 @@ async def lifespan(app: FastAPI) -> Any:
lifespan=lifespan,
)

app.add_event_handler("startup", get_log_handler().init_logger)

# Set all CORS enabled origins
if settings.BACKEND_CORS_ORIGINS:
Expand All @@ -47,13 +53,13 @@ async def lifespan(app: FastAPI) -> Any:
)

app.include_router(api_router, prefix=settings.API_V2_STR)
print("Included routes, app should now be reachable")
logger.info("Included routes, app should now be reachable")


if settings.DEV_MODE:
print("Staging protocol changes...")
logger.info("Staging protocol changes...")
status = stage_protocol_changes()
print(status)
logger.info(f"Staging protocol result: {status}")


# needed for Google Kubernetes Engine LoadBalancer Healthcheck
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/backend/grid/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export NODE_TYPE=$NODE_TYPE
echo "NODE_UID=$NODE_UID"
echo "NODE_TYPE=$NODE_TYPE"

exec $DEBUG_CMD uvicorn $RELOAD --host $HOST --port $PORT --log-level $LOG_LEVEL "$APP_MODULE"
exec $DEBUG_CMD uvicorn $RELOAD --host $HOST --port $PORT --log-config=$APPDIR/grid/logging.yaml --log-level $LOG_LEVEL "$APP_MODULE"
1 change: 0 additions & 1 deletion packages/syft/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ syft =
bcrypt==4.1.2
boto3==1.34.56
forbiddenfruit==0.1.4
loguru==0.7.2
packaging>=23.0
pyarrow==15.0.0
pycapnp==2.0.0
Expand Down
Loading

0 comments on commit 527073c

Please sign in to comment.