fix by review

This commit is contained in:
moririn2528
2023-08-16 14:49:38 +09:00
parent 852dd3d16b
commit 3f4e118b5d
2 changed files with 3 additions and 7 deletions
+2 -6
View File
@@ -275,12 +275,8 @@ def create_app(
response.status = 400 # Bad request
return {"reason": "You need to set best_trials and worst_trials"}
try:
preferences = [(best, worst) for best in best_trials for worst in worst_trials]
report_preferences(study_id, storage, preferences)
except Exception as e:
response.status = 500
return {"reason": f"Internal server error: {e}"}
preferences = [(best, worst) for best in best_trials for worst in worst_trials]
report_preferences(study_id, storage, preferences)
response.status = 204
return {}
@@ -14,7 +14,7 @@ _SYSTEM_ATTR_PREFIX_PREFERENCE = "preference:values"
def report_preferences(
study_id: int,
storage: BaseStorage,
preferences: list[tuple[int, int]], # element is number of trail
preferences: list[tuple[int, int]],
) -> None:
key = _SYSTEM_ATTR_PREFIX_PREFERENCE + str(uuid.uuid4())
storage.set_study_system_attr(