Skip to content

Commit 1e66ce8

Browse files
v0.5.19
init and path handling for tensorboard modified
1 parent 8e57cee commit 1e66ce8

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.5.18"
10+
version = "0.5.19"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/utils/file.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,13 @@ def get_spot_tensorboard_path(experiment_name):
8787
spot_tensorboard_path = os.environ.get("PATH_TENSORBOARD", "runs/spot_logs/")
8888
spot_tensorboard_path = os.path.join(spot_tensorboard_path, experiment_name)
8989
return spot_tensorboard_path
90+
91+
92+
def get_tensorboard_path(fun_control):
93+
"""Get the path to the tensorboard files.
94+
Args:
95+
fun_control (dict): The function control dictionary.
96+
Returns:
97+
tensorboard_path (str): The path to the folder where the tensorboard files are saved.
98+
"""
99+
return fun_control["TENSORBOARD_PATH"]

src/spotPython/utils/init.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ def fun_control_init(
8888
# if the folder "runs" exists, move it to "runs_Y_M_D_H_M_S" to avoid overwriting old tensorboard files
8989
if os.path.exists(TENSORBOARD_PATH):
9090
now = datetime.datetime.now()
91+
os.makedirs("runs_OLD", exist_ok=True)
9192
# use [:-1] to remove "/" from the end of the path
92-
TENSORBOARD_PATH_OLD = TENSORBOARD_PATH[:-1] + now.strftime("%Y_%m_%d_%H_%M_%S")
93+
TENSORBOARD_PATH_OLD = "runs_OLD/" + TENSORBOARD_PATH[:-1] + "_" + now.strftime("%Y_%m_%d_%H_%M_%S")
9394
os.rename(TENSORBOARD_PATH[:-1], TENSORBOARD_PATH_OLD)
9495
os.makedirs(TENSORBOARD_PATH, exist_ok=True)
9596
if spot_tensorboard_path is not None:

0 commit comments

Comments
 (0)