mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
fix by review
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user