Skip to content

Commit

Permalink
Respect worker log level config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
soapy1 committed Oct 19, 2024
1 parent 7d39efa commit a752f6d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 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,19 @@ 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", 50:"FATAL", 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 a752f6d

Please sign in to comment.