Skip to content

Commit 43733dd

Browse files
shrutipatel31facebook-github-bot
authored andcommitted
Include INFO status healthcheck cards in overview to save to db (#5022)
Summary: In order for the INFO healthcheck cards to be shown in the Ax UI, they need to be saved to the db. This diff adds those cards to overview cards so they can be saved appropriately. Differential Revision: D96492464
1 parent d307d49 commit 43733dd

2 files changed

Lines changed: 46 additions & 6 deletions

File tree

ax/analysis/overview.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
ConstraintsFeasibilityAnalysis,
2121
)
2222
from ax.analysis.healthcheck.early_stopping_healthcheck import EarlyStoppingAnalysis
23-
from ax.analysis.healthcheck.healthcheck_analysis import HealthcheckAnalysisCard
23+
from ax.analysis.healthcheck.healthcheck_analysis import (
24+
HealthcheckAnalysisCard,
25+
HealthcheckStatus,
26+
)
2427
from ax.analysis.healthcheck.metric_fetching_errors import MetricFetchingErrorsAnalysis
2528
from ax.analysis.healthcheck.predictable_metrics import PredictableMetricsAnalysis
2629
from ax.analysis.healthcheck.search_space_analysis import SearchSpaceAnalysis
@@ -265,10 +268,15 @@ def compute(
265268
if analyis is not None
266269
]
267270

268-
non_passing_health_checks = [
271+
user_facing_health_check_cards = [
269272
card
270273
for card in health_check_cards
271-
if (isinstance(card, HealthcheckAnalysisCard) and not card.is_passing())
274+
if (
275+
isinstance(card, HealthcheckAnalysisCard)
276+
and (
277+
not card.is_passing() or card.get_status() == HealthcheckStatus.INFO
278+
)
279+
)
272280
or isinstance(card, ErrorAnalysisCard)
273281
]
274282

@@ -277,9 +285,9 @@ def compute(
277285
name="HealthchecksAnalysis",
278286
title=HEALTH_CHECK_CARDGROUP_TITLE,
279287
subtitle=HEALTH_CHECK_CARDGROUP_SUBTITLE,
280-
children=non_passing_health_checks,
288+
children=user_facing_health_check_cards,
281289
)
282-
if len(non_passing_health_checks) > 0
290+
if len(user_facing_health_check_cards) > 0
283291
else None
284292
)
285293

ax/analysis/tests/test_overview.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
# pyre-strict
77

8-
98
from datetime import datetime
9+
from unittest.mock import patch
1010

1111
import pandas as pd
1212
from ax.adapter.base import Adapter
1313
from ax.adapter.registry import Generators
14+
from ax.analysis.healthcheck.healthcheck_analysis import (
15+
create_healthcheck_analysis_card,
16+
HealthcheckStatus,
17+
)
1418
from ax.analysis.insights import InsightsAnalysis
1519
from ax.analysis.overview import OverviewAnalysis
1620
from ax.analysis.plotly.arm_effects import ArmEffectsPlot
@@ -38,6 +42,7 @@
3842
from ax.utils.common.testutils import TestCase
3943
from ax.utils.testing.core_stubs import (
4044
get_data,
45+
get_experiment,
4146
get_experiment_with_scalarized_objective_and_outcome_constraint,
4247
get_offline_experiments_subset,
4348
get_online_experiments,
@@ -447,3 +452,30 @@ def test_insights_analysis_single_parameter(self) -> None:
447452
# Check that none of the cards are error cards
448453
for card in all_cards:
449454
self.assertNotIsInstance(card, ErrorAnalysisCard)
455+
456+
def test_info_status_healthcheck_included_in_overview(self) -> None:
457+
"""Test that healthcheck cards with INFO status are included in the overview."""
458+
info_card = create_healthcheck_analysis_card(
459+
name="InfoHealthcheck",
460+
title="Info Healthcheck",
461+
subtitle="This is an info healthcheck",
462+
df=pd.DataFrame(),
463+
status=HealthcheckStatus.INFO,
464+
)
465+
466+
with patch(
467+
"ax.analysis.overview.ConstraintsFeasibilityAnalysis.compute_or_error_card",
468+
return_value=info_card,
469+
):
470+
overview_card = OverviewAnalysis().compute(
471+
experiment=get_experiment(),
472+
generation_strategy=None,
473+
)
474+
475+
health_checks_group = next(
476+
child
477+
for child in overview_card.children
478+
if child.name == "HealthchecksAnalysis"
479+
)
480+
health_check_names = [card.name for card in health_checks_group.flatten()]
481+
self.assertIn("InfoHealthcheck", health_check_names)

0 commit comments

Comments
 (0)