Skip to content

Commit aee2dc7

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. Reviewed By: bernardbeckerman Differential Revision: D96492464
1 parent 43c5790 commit aee2dc7

4 files changed

Lines changed: 47 additions & 5 deletions

File tree

ax/analysis/healthcheck/healthcheck_analysis.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ def get_status(self) -> HealthcheckStatus:
2626
def is_passing(self) -> bool:
2727
return self.get_status() in (HealthcheckStatus.PASS, HealthcheckStatus.INFO)
2828

29+
def is_user_facing(self) -> bool:
30+
"""Returns True if this card should be displayed to users.
31+
32+
User-facing cards:
33+
- FAIL: Critical issues blocking the experiment and requiring immediate attention
34+
- WARNING: Potential issues that can lead to issues in the future
35+
- INFO: Informational context and feature upsells
36+
37+
Hidden cards:
38+
- PASS: No issues, nothing noteworthy to display
39+
"""
40+
return self.get_status() != HealthcheckStatus.PASS
41+
2942
def get_aditional_attrs(self) -> dict[str, str | int | float | bool]:
3043
return json.loads(self.blob)
3144

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
# pyre-strict
7+
8+
import pandas as pd
9+
from ax.analysis.healthcheck.healthcheck_analysis import (
10+
create_healthcheck_analysis_card,
11+
HealthcheckStatus,
12+
)
13+
from ax.utils.common.testutils import TestCase
14+
15+
16+
class TestHealthcheckAnalysisCard(TestCase):
17+
def test_is_user_facing(self) -> None:
18+
# Only PASS status should be hidden; all others are user-facing
19+
for status in HealthcheckStatus:
20+
with self.subTest(status=status.name):
21+
card = create_healthcheck_analysis_card(
22+
name="TestAnalysis",
23+
title="Test Healthcheck",
24+
subtitle="Test subtitle",
25+
df=pd.DataFrame(),
26+
status=status,
27+
)
28+
expected = status != HealthcheckStatus.PASS
29+
self.assertEqual(card.is_user_facing(), expected)

ax/analysis/overview.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,11 @@ def compute(
265265
if analyis is not None
266266
]
267267

268-
non_passing_health_checks = [
268+
user_facing_health_check_cards = [
269269
card
270270
for card in health_check_cards
271-
if (isinstance(card, HealthcheckAnalysisCard) and not card.is_passing())
271+
if isinstance(card, HealthcheckAnalysisCard)
272+
and card.is_user_facing()
272273
or isinstance(card, ErrorAnalysisCard)
273274
]
274275

@@ -277,9 +278,9 @@ def compute(
277278
name="HealthchecksAnalysis",
278279
title=HEALTH_CHECK_CARDGROUP_TITLE,
279280
subtitle=HEALTH_CHECK_CARDGROUP_SUBTITLE,
280-
children=non_passing_health_checks,
281+
children=user_facing_health_check_cards,
281282
)
282-
if len(non_passing_health_checks) > 0
283+
if len(user_facing_health_check_cards) > 0
283284
else None
284285
)
285286

ax/analysis/tests/test_overview.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
# pyre-strict
77

8-
98
from datetime import datetime
109

1110
import pandas as pd

0 commit comments

Comments
 (0)