Skip to content

Commit 5a9c283

Browse files
authored
Merge pull request #208 from tornede/204-table_name-parameter-does-not-adapt-name-of-logtable
204 table name parameter does not adapt name of logtable
2 parents a02f95f + df8b564 commit 5a9c283

File tree

7 files changed

+619
-446
lines changed

7 files changed

+619
-446
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ output/
150150
# codecarbon
151151
.codecarbon.config
152152
emissions.csv
153+
powermetrics_log.txt
153154

154155
# development folder
155156
development/
157+

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
=========
22
Changelog
33
=========
4+
v1.4.3 (**.**.2025)
5+
===================
6+
7+
Fix
8+
===
49

10+
- Fix bug, where the logtable_name was not overwritten by `table_name` updates in the `PyExperimenter` class.
511

612
v1.4.2 (12.06.2024)
713
===================

docs/source/examples/example_logtables.ipynb

Lines changed: 272 additions & 286 deletions
Large diffs are not rendered by default.

poetry.lock

Lines changed: 329 additions & 154 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py_experimenter/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import logging
22
from abc import ABC, abstractclassmethod
33
from logging import Logger
4-
from typing import Any, Dict, List, Tuple, Union
4+
from typing import Any, Dict, List, Optional, Tuple, Union
55

66
import numpy as np
77
import omegaconf
88
from attr import dataclass
99
from omegaconf import DictConfig, ListConfig, OmegaConf
1010

1111
from py_experimenter import utils
12-
from py_experimenter.exceptions import InvalidColumnError, InvalidConfigError, InvalidLogtableError
12+
from py_experimenter.exceptions import (
13+
InvalidColumnError,
14+
InvalidLogtableError,
15+
)
1316

1417

1518
class Cfg(ABC):
@@ -362,8 +365,10 @@ def __init__(
362365
self.codecarbon_configuration = codecarbon_configuration
363366

364367
@staticmethod
365-
def extract_config(config_path: str, logger: logging.Logger) -> "PyExperimenterCfg":
368+
def extract_config(config_path: str, logger: logging.Logger, overwritten_table_name: Optional[str] = None) -> "PyExperimenterCfg":
366369
config = omegaconf.OmegaConf.load(config_path)
370+
if overwritten_table_name is not None:
371+
config["PY_EXPERIMENTER"]["Database"]["table"]["name"] = overwritten_table_name
367372

368373
if "n_jobs" not in config["PY_EXPERIMENTER"]:
369374
config["PY_EXPERIMENTER"]["n_jobs"] = 1

py_experimenter/experimenter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
handler.setFormatter(formatter)
9797
self.logger.addHandler(handler)
9898

99-
self.config = PyExperimenterCfg.extract_config(experiment_configuration_file_path, logger=self.logger)
99+
self.config = PyExperimenterCfg.extract_config(experiment_configuration_file_path, logger=self.logger, overwritten_table_name=table_name)
100100

101101
self.use_codecarbon = use_codecarbon
102102

@@ -109,8 +109,6 @@ def __init__(
109109
if use_ssh_tunnel is not None:
110110
self.config.database_configuration.use_ssh_tunnel = use_ssh_tunnel
111111

112-
if table_name is not None:
113-
self.config.database_configuration.table_name = table_name
114112
if database_name is not None:
115113
self.config.database_configuration.database_name = database_name
116114
self.name = name

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ codecarbon = ">=2.2.1"
3737
pymysql = "^1.0.3"
3838
omegaconf = "^2.3.0"
3939
sshtunnel = "^0.4.0"
40+
setuptools = "^69.5.1"
4041

4142
[tool.poetry.group.dev.dependencies]
4243
pytest = ">=7.0"

0 commit comments

Comments
 (0)