Skip to content

Commit fbab2d5

Browse files
Set trials to abandon on _mark_err_trial_status (facebook#4779)
Summary: Pull Request resolved: facebook#4779 When a metric used in the OptimizationConfig fails to fetch, mark the trial as ABANDONED rather than FAILED so that it is less likely to be tried again. Reviewed By: mpolson64 Differential Revision: D90884185 fbshipit-source-id: c23af50d3f7633ef82cfc2c8729b7d21be830c5a
1 parent bcabace commit fbab2d5

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

ax/orchestration/orchestrator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,9 +2121,10 @@ def _mark_err_trial_status(
21212121
metric_name: str | None = None,
21222122
metric_fetch_e: MetricFetchE | None = None,
21232123
) -> TrialStatus:
2124-
trial.mark_failed(unsafe=True)
2125-
2126-
return TrialStatus.FAILED
2124+
trial.mark_abandoned(
2125+
reason=metric_fetch_e.message if metric_fetch_e else None, unsafe=True
2126+
)
2127+
return TrialStatus.ABANDONED
21272128

21282129
def _get_failure_rate_exceeded_error(
21292130
self,

ax/orchestration/tests/test_orchestrator.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,14 +1857,16 @@ def test_fetch_and_process_trials_data_results_failed_objective(self) -> None:
18571857
any(
18581858
re.search(
18591859
r"Because (branin|m1) is an objective, marking trial 0 as "
1860-
"TrialStatus.FAILED",
1860+
"TrialStatus.ABANDONED",
18611861
warning,
18621862
)
18631863
is not None
18641864
for warning in lg.output
18651865
)
18661866
)
1867-
self.assertEqual(orchestrator.experiment.trials[0].status, TrialStatus.FAILED)
1867+
self.assertEqual(
1868+
orchestrator.experiment.trials[0].status, TrialStatus.ABANDONED
1869+
)
18681870

18691871
def test_fetch_and_process_trials_data_results_failed_objective_but_recoverable(
18701872
self,
@@ -1957,14 +1959,16 @@ def test_fetch_and_process_trials_data_results_failed_objective_not_recoverable(
19571959
any(
19581960
re.search(
19591961
r"Because (branin|m1) is an objective, marking trial 0 as "
1960-
"TrialStatus.FAILED",
1962+
"TrialStatus.ABANDONED",
19611963
warning,
19621964
)
19631965
is not None
19641966
for warning in lg.output
19651967
)
19661968
)
1967-
self.assertEqual(orchestrator.experiment.trials[0].status, TrialStatus.FAILED)
1969+
self.assertEqual(
1970+
orchestrator.experiment.trials[0].status, TrialStatus.ABANDONED
1971+
)
19681972

19691973
def test_should_consider_optimization_complete(self) -> None:
19701974
# Tests non-GSS parts of the completion criterion.

0 commit comments

Comments
 (0)