Skip to content

Commit ed18ec1

Browse files
committed
handle the case when the script silently fails producing an empty data file
1 parent e2d81d2 commit ed18ec1

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

mlos_bench/mlos_bench/environments/local/local_env.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ def run(self) -> tuple[Status, datetime, dict[str, TunableValue] | None]:
206206
)
207207

208208
_LOG.debug("Read data:\n%s", data)
209-
if list(data.columns) == ["metric", "value"]:
209+
if len(data) == 0:
210+
_LOG.warning("Empty metrics file - fail the run")
211+
return (Status.FAILED, timestamp, None)
212+
elif list(data.columns) == ["metric", "value"]:
210213
_LOG.info(
211214
"Local results have (metric,value) header and %d rows: assume long format",
212215
len(data),

mlos_bench/mlos_bench/optimizers/mlos_core_optimizer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ def bulk_register(
280280
df_configs = self._to_df(configs) # Impute missing values, if necessary
281281

282282
df_scores = self._adjust_signs_df(
283-
pd.DataFrame([{} if score is None else score for score in scores])
283+
pd.DataFrame(
284+
[{} if score is None else score for score in scores],
285+
columns=list(self._opt_targets),
286+
)
284287
)
285288

286289
if status is not None:

0 commit comments

Comments
 (0)