Fix the bug while renaming a study with maximize direction

This commit is contained in:
lucasmrdt committed 2023-08-24 16:07:03 +02:00
1 parent 5c5270b4bd
commit d11d777029
1 file changed
+5 -1
+5 -1
View File
@@ -139,8 +139,12 @@ def create_app(
response.status = 404 # Not found
return {"reason": f"study_id={study_id} is not found"}
summary = get_study_summary(storage, study_id)
if summary is None:
response.status = 500
return {"reason": "Failed to load the study"}
try:
dst_study = optuna.create_study(storage=storage, study_name=dst_study_name)
dst_study = optuna.create_study(storage=storage, study_name=dst_study_name, directions=summary.directions)
dst_study.add_trials(src_study.get_trials(deepcopy=False))
except DuplicatedStudyError:
response.status = 400 # Bad request