[f8624c]: / ai_genomics / __init__.py

Download this file

38 lines (27 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""ai_genomics."""
import logging
import logging.config
from pathlib import Path
from typing import Optional
import yaml
def get_yaml_config(file_path: Path) -> Optional[dict]:
"""Fetch yaml config and return as dict if it exists."""
if file_path.exists():
with open(file_path, "rt") as f:
return yaml.load(f.read(), Loader=yaml.FullLoader)
# Define project base directory
PROJECT_DIR = Path(__file__).resolve().parents[1]
# Define log output locations
info_out = str(PROJECT_DIR / "info.log")
error_out = str(PROJECT_DIR / "errors.log")
bucket_name = 'ai-genomics'
# Read log config file
_log_config_path = Path(__file__).parent.resolve() / "config/logging.yaml"
_logging_config = get_yaml_config(_log_config_path)
if _logging_config:
logging.config.dictConfig(_logging_config)
# Define module logger
logger = logging.getLogger(__name__)
# base/global config
_base_config_path = Path(__file__).parent.resolve() / "config/base.yaml"
config = get_yaml_config(_base_config_path)