Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

Commit 59c92ce

Browse files
committed
Include logs from all Python code, not just from uvicorn
1 parent f1ef2c5 commit 59c92ce

6 files changed

Lines changed: 41 additions & 1 deletion

File tree

api/deployment/Dockerfile.prod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ENV PYTHONPATH /home/docker:${SITEDIR}:${VENV}/lib/python3.11/site-packages:/us
3737

3838
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
3939
RUN rm /etc/nginx/sites-enabled/default
40+
COPY log_conf.yaml ${SITEDIR}/log_conf.yaml
4041
COPY deployment/nginx-app-prod.conf /etc/nginx/sites-enabled/nginx-app.conf
4142
COPY deployment/supervisor-app.conf /etc/supervisor/conf.d/
4243

api/deployment/supervisor-app.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ stderr_logfile_maxbytes = 0
1212
socket = unix:///tmp/uvicorn.sock
1313
socket_owner = www-data
1414
user = www-data
15-
command = /home/docker/venv/bin/uvicorn simqueue.main:app --proxy-headers --uds /tmp/uvicorn.sock --timeout-keep-alive 300
15+
command = /home/docker/venv/bin/uvicorn simqueue.main:app --proxy-headers --uds /tmp/uvicorn.sock --timeout-keep-alive 300 --log-config /home/docker/site/log_conf.yaml
1616
numprocs = 2
1717
process_name = uvicorn-%(process_num)d
1818
stdout_logfile = /dev/stdout

api/log_conf.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 1
2+
disable_existing_loggers: False
3+
formatters:
4+
default:
5+
# "()": uvicorn.logging.DefaultFormatter
6+
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
7+
access:
8+
# "()": uvicorn.logging.AccessFormatter
9+
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
10+
handlers:
11+
default:
12+
formatter: default
13+
class: logging.StreamHandler
14+
stream: ext://sys.stderr
15+
access:
16+
formatter: access
17+
class: logging.StreamHandler
18+
stream: ext://sys.stdout
19+
loggers:
20+
uvicorn.error:
21+
level: INFO
22+
handlers:
23+
- default
24+
propagate: no
25+
uvicorn.access:
26+
level: INFO
27+
handlers:
28+
- access
29+
propagate: no
30+
root:
31+
level: INFO
32+
handlers:
33+
- default
34+
propagate: no

api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ requests
1111
numpy
1212
python-slugify
1313
ebrains-drive
14+
PyYAML

api/requirements.txt.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pydantic==2.10.6
2121
pydantic_core==2.27.2
2222
python-slugify==8.0.4
2323
pytz==2025.1
24+
PyYAML==6.0.3
2425
requests==2.32.3
2526
sniffio==1.3.1
2627
SQLAlchemy==2.0.39

api/simqueue/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ async def check_quotas(collab: str, hardware_platform: str, user: str = None):
3838
for quota in available_quotas:
3939
if quota["usage"] < quota["limit"]:
4040
return True
41+
logger.info(
42+
f"No quota available for user {user} on {hardware_platform}. collab={collab}, available quotas: {available_quotas}"
43+
)
4144
return False
4245

4346

0 commit comments

Comments
 (0)