Skip to content

Commit ef0fd00

Browse files
save_experiment issues a warning when copy fails
1 parent ba85cce commit ef0fd00

2 files changed

Lines changed: 8 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.15.17"
10+
version = "0.15.18"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotpython/spot/spot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,13 @@ def save_experiment(self, filename=None) -> None:
23082308
optimizer_control = copy.deepcopy(self.optimizer_control)
23092309
surrogate_control = copy.deepcopy(self.surrogate_control)
23102310
design_control = copy.deepcopy(self.design_control)
2311-
spot_tuner = copy.deepcopy(self)
2311+
# try to copy the spot_tuner object. If not possible,issue a warning and set spot_tuner to None.
2312+
try:
2313+
spot_tuner = copy.deepcopy(self)
2314+
except Exception as e:
2315+
logger.warning("Warning: Could not copy/save spot_tuner object!")
2316+
logger.warning(f"Error: {e}")
2317+
spot_tuner = None
23122318
experiment = {
23132319
"design_control": design_control,
23142320
"fun_control": fun_control,

0 commit comments

Comments
 (0)