Skip to content

Commit

Permalink
Respect worker log level config setting (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
soapy1 authored Oct 24, 2024
1 parent 12f7188 commit 6fb6d6a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion conda-store-server/conda_store_server/_internal/worker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,23 @@ def initialize(self, *args, **kwargs):
# ensure checks on redis_url
self.conda_store.redis_url

def logger_to_celery_logging_level(self, logging_level):
# celery supports the log levels DEBUG | INFO | WARNING | ERROR | CRITICAL | FATAL
# https://docs.celeryq.dev/en/main/reference/cli.html#celery-worker
logging_to_celery_level_map = {
50: "CRITICAL",
40: "ERROR",
30: "WARNING",
20: "INFO",
10: "DEBUG",
}
return logging_to_celery_level_map[logging_level]

def start(self):

argv = [
"worker",
"--loglevel=INFO",
f"--loglevel={self.logger_to_celery_logging_level(self.log_level)}",
"--max-tasks-per-child=10", # mitigate memory leaks
]

Expand Down

0 comments on commit 6fb6d6a

Please sign in to comment.