Skip to content

KeyError: 'loggers' #11

Description

@salanova-elliott

Hello,

I am running into some trouble while executing metaDMG on both my personal computer and an HPC cluster (both Linux). I built metaDMG-cpp using this conda environment:

conda create -n metaDMG-cpp python=3.9 eigen htslib cxx-compiler gsl

And then used the environment.yaml file from metaDMG-core to install metaDMG. metaDMG config produces the expected config.yaml file with metaDMG-cpp pointing to the correct location, but running metaDMG compute throws KeyError: 'loggers' that's maybe related to a package dependency? conda list shows that logger-tt is installed in the environment. Both the cluster and my personal computer have thrown this same error, any idea what it could be related to?

Full error text follows:

/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/metaDMG/cli/cli.py:324 in compute │
│ │
│ 321 │ from metaDMG.fit import get_logger_port_and_path, run_workflow, setup_logger │
│ 322 │ │
│ 323 │ log_port, log_path = get_logger_port_and_path() │
│ ❱ 324 │ setup_logger(log_port=log_port, log_path=log_path) │
│ 325 │ │
│ 326 │ configs = utils.make_configs( │
│ 327 │ │ config_file=config_file, │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ config_file = PosixPath('config.yaml') │ │
│ │ force = False │ │
│ │ get_logger_port_and_path = <function get_logger_port_and_path at 0x7feb30df5700> │ │
│ │ log_path = 'logs/log__2023-03-22__09-53-11.log' │ │
│ │ log_port = 51816 │ │
│ │ run_workflow = <function run_workflow at 0x7feb40ab20d0> │ │
│ │ setup_logger = <function setup_logger at 0x7feb30df54c0> │ │
│ │ utils = <module 'metaDMG.utils' from │ │
│ │ '/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/me… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/metaDMG/loggers/loggers.py:29 in │
│ setup_logger │
│ │
│ 26 │ with resources.path("metaDMG.loggers", "log_config.yaml") as p: │
│ 27 │ │ log_config_path = p │
│ 28 │ │
│ ❱ 29 │ setup_logging( │
│ 30 │ │ config_path=str(log_config_path), │
│ 31 │ │ log_path=log_path, │
│ 32 │ │ port=log_port, │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ log_config_path = PosixPath('/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/m… │ │
│ │ log_path = 'logs/log__2023-03-22__09-53-11.log' │ │
│ │ log_port = 51816 │ │
│ │ p = PosixPath('/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/m… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/logger_tt/init.py:196 in │
│ setup_logging │
│ │
│ 193 │ │
│ 194 │ # load config from file │
│ 195 │ config = load_from_file(cfgpath) │
│ ❱ 196 │ remove_unused_handlers(config) │
│ 197 │ logger_tt_cfg = config.pop('logger_tt', {}) │
│ 198 │ if current_process().name == 'MainProcess': │
│ 199 │ │ ensure_path(config, log_path) # create log path if not exist │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ cfgpath = PosixPath('/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/… │ │
│ │ config = { │ │
│ │ │ 'version': 1, │ │
│ │ │ 'disable_existing_loggers': False, │ │
│ │ │ 'formatters': { │ │
│ │ │ │ 'simple': { │ │
│ │ │ │ │ 'format': '[%(asctime)s] | %(name)s:%(lineno)d | │ │
│ │ %(levelname)s | %(message)s', │ │
│ │ │ │ │ 'datefmt': '%Y-%m-%d %H:%M:%S', │ │
│ │ │ │ │ 'class': 'logger_tt.core.DefaultFormatter' │ │
│ │ │ │ }, │ │
│ │ │ │ 'brief': { │ │
│ │ │ │ │ 'format': '%(message)s', │ │
│ │ │ │ │ 'datefmt': '%Y-%m-%d %H:%M:%S', │ │
│ │ │ │ │ 'class': 'logger_tt.core.DefaultFormatter' │ │
│ │ │ │ } │ │
│ │ │ }, │ │
│ │ │ 'handlers': { │ │
│ │ │ │ 'console': { │ │
│ │ │ │ │ 'class': 'rich.logging.RichHandler', │ │
│ │ │ │ │ 'level': 'INFO', │ │
│ │ │ │ │ 'formatter': 'brief', │ │
│ │ │ │ │ 'show_time': True, │ │
│ │ │ │ │ 'show_level': True, │ │
│ │ │ │ │ 'show_path': False, │ │
│ │ │ │ │ 'rich_tracebacks': True, │ │
│ │ │ │ │ 'log_time_format': '%Y-%m-%d %H:%M:%S' │ │
│ │ │ │ }, │ │
│ │ │ │ 'error_file_handler': { │ │
│ │ │ │ │ 'class': 'logging.FileHandler', │ │
│ │ │ │ │ 'level': 'DEBUG', │ │
│ │ │ │ │ 'formatter': 'simple', │ │
│ │ │ │ │ 'filename': 'logs/log.txt', │ │
│ │ │ │ │ 'encoding': 'utf8' │ │
│ │ │ │ } │ │
│ │ │ }, │ │
│ │ │ 'root': { │ │
│ │ │ │ 'level': 'DEBUG', │ │
│ │ │ │ 'handlers': ['console', 'error_file_handler'] │ │
│ │ │ }, │ │
│ │ │ 'logger_tt': { │ │
│ │ │ │ 'suppress': ['numba', 'jax'], │ │
│ │ │ │ 'suppress_level_below': 'WARNING', │ │
│ │ │ │ 'capture_print': False, │ │
│ │ │ │ 'strict': False, │ │
│ │ │ │ 'guess_level': False, │ │
│ │ │ │ 'full_context': 0, │ │
│ │ │ │ 'use_multiprocessing': True, │ │
│ │ │ │ 'limit_line_length': 1000, │ │
│ │ │ │ 'analyze_raise_statement': False │ │
│ │ │ } │ │
│ │ } │ │
│ │ config_path = '/home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/metaDMG/lo… │ │
│ │ log_path = 'logs/log__2023-03-22__09-53-11.log' │ │
│ │ logger_tt_config = {'port': 51816} │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/lel047/.conda/envs/metaDMG/lib/python3.9/site-packages/logger_tt/init.py:148 in │
│ remove_unused_handlers │
│ │
│ 145 │ """ │
│ 146 │ all_handlers = list(config['handlers']) │
│ 147 │ used_handlers = config['root']['handlers'] │
│ ❱ 148 │ for name in config['loggers']: │
│ 149 │ │ handlers = config['loggers'][name]["handlers"] │
│ 150 │ │ used_handlers.extend(handlers) │
│ 151 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ all_handlers = ['console', 'error_file_handler'] │ │
│ │ config = { │ │
│ │ │ 'version': 1, │ │
│ │ │ 'disable_existing_loggers': False, │ │
│ │ │ 'formatters': { │ │
│ │ │ │ 'simple': { │ │
│ │ │ │ │ 'format': '[%(asctime)s] | %(name)s:%(lineno)d | %(levelname)s | │ │
│ │ %(message)s', │ │
│ │ │ │ │ 'datefmt': '%Y-%m-%d %H:%M:%S', │ │
│ │ │ │ │ 'class': 'logger_tt.core.DefaultFormatter' │ │
│ │ │ │ }, │ │
│ │ │ │ 'brief': { │ │
│ │ │ │ │ 'format': '%(message)s', │ │
│ │ │ │ │ 'datefmt': '%Y-%m-%d %H:%M:%S', │ │
│ │ │ │ │ 'class': 'logger_tt.core.DefaultFormatter' │ │
│ │ │ │ } │ │
│ │ │ }, │ │
│ │ │ 'handlers': { │ │
│ │ │ │ 'console': { │ │
│ │ │ │ │ 'class': 'rich.logging.RichHandler', │ │
│ │ │ │ │ 'level': 'INFO', │ │
│ │ │ │ │ 'formatter': 'brief', │ │
│ │ │ │ │ 'show_time': True, │ │
│ │ │ │ │ 'show_level': True, │ │
│ │ │ │ │ 'show_path': False, │ │
│ │ │ │ │ 'rich_tracebacks': True, │ │
│ │ │ │ │ 'log_time_format': '%Y-%m-%d %H:%M:%S' │ │
│ │ │ │ }, │ │
│ │ │ │ 'error_file_handler': { │ │
│ │ │ │ │ 'class': 'logging.FileHandler', │ │
│ │ │ │ │ 'level': 'DEBUG', │ │
│ │ │ │ │ 'formatter': 'simple', │ │
│ │ │ │ │ 'filename': 'logs/log.txt', │ │
│ │ │ │ │ 'encoding': 'utf8' │ │
│ │ │ │ } │ │
│ │ │ }, │ │
│ │ │ 'root': { │ │
│ │ │ │ 'level': 'DEBUG', │ │
│ │ │ │ 'handlers': ['console', 'error_file_handler'] │ │
│ │ │ }, │ │
│ │ │ 'logger_tt': { │ │
│ │ │ │ 'suppress': ['numba', 'jax'], │ │
│ │ │ │ 'suppress_level_below': 'WARNING', │ │
│ │ │ │ 'capture_print': False, │ │
│ │ │ │ 'strict': False, │ │
│ │ │ │ 'guess_level': False, │ │
│ │ │ │ 'full_context': 0, │ │
│ │ │ │ 'use_multiprocessing': True, │ │
│ │ │ │ 'limit_line_length': 1000, │ │
│ │ │ │ 'analyze_raise_statement': False │ │
│ │ │ } │ │
│ │ } │ │
│ │ used_handlers = ['console', 'error_file_handler'] │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'loggers'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions