class LoggerModel(BaseModel): config: JohannConfig = JohannConfig.get_config() name: str file: str = config.LOG_FILE level: int = config.LOG_LEVEL max_bytes: ByteSize = config.LOG_MAX_BYTES backup_count: int = config.LOG_BACKUP_COUNT file_level: int = config.LOG_FILE_LEVEL format: str = config.LOG_FORMAT
def configure_workers(sender=None, conf=None, **kwar): global config global logger config = JohannConfig.get_config() logger = JohannLogger(__name__).logger johann.util.load_plugins() logger.debug( "Celery registered" f" tasks:\n{pprint.pformat(johann.util.celery_registered_tasks())}") logger.debug(config.json(indent=2, sort_keys=True))
# Use of this source code is governed by a BSD-3-clause license that can # be found in the LICENSE file. See the AUTHORS file for names of contributors. import json import os import time import pytest import requests from johann.shared.config import JohannConfig from johann.shared.enums import TaskState from johann.shared.logger import JohannLogger CONDUCTOR_URL = os.getenv("CONDUCTOR_URL", "http://johann_conductor:5000") config = JohannConfig.get_config() logger = JohannLogger(__name__).logger @pytest.fixture(autouse=True) # fix an annoying artifact of pytest's otherwise useful '-s' mode def prettier_output(): print() yield print() def wait_for_score(score, expect_success=True, timeout=300, check_interval=5): logger.info(f"Waiting for {score} to complete...") now = time.time()