EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE_OS

Log files don't appear when running MUSE from a Python script

Abierto
#600 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
29
Forks
12
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

If you run muse from the command line (e.g. `muse settings.toml`), you'll get a couple of log files appearing in the results folder.

Another way of running MUSE is from a Python script, for example:

```
from logging import getLogger
from muse.mca import MCA
from muse.readers.toml import read_settings
from pathlib import Path

current_script_path = Path(__file__).resolve()
path_settings = current_script_path.parent / 'settings.toml'
settings = read_settings(path_settings)
getLogger("muse").setLevel(settings.log_level)
model = MCA.factory(settings)
model.run()
```

However, in this case the log files don't appear.

We could make users call `add_file_logger()` manually when running muse from a script, but it would be nice if this was the default behaviour without users having to do this

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza por seguir cómo `MCA.factory(settings)` y `model.run()` configuran el registro cuando MUSE se inicia desde un script, y compáralo con la ruta de la línea de comandos. Inspecciona el punto de entrada existente `add_file_logger()` y verifica que las ejecuciones basadas en scripts creen los archivos de registro esperados en la carpeta de resultados sin requerir una llamada manual.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.