Skip to content

Commit

Permalink
Healthcheck analysis class
Browse files Browse the repository at this point in the history
Summary: Add abstract class for health checks

Reviewed By: mpolson64

Differential Revision: D60417357
  • Loading branch information
Cesar-Cardoso authored and facebook-github-bot committed Aug 8, 2024
1 parent e1fd26a commit da3f3c1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ax/analysis/healthcheck/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# pyre-strict

from ax.analysis.healthcheck.healthcheck_analysis import (
HealthcheckAnalysis,
HealthcheckAnalysisCard,
HealthcheckStatus,
)

__all__ = [
"HealthcheckAnalysis",
"HealthcheckAnalysisCard",
"HealthcheckStatus",
]
38 changes: 38 additions & 0 deletions ax/analysis/healthcheck/healthcheck_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# pyre-strict
import json
from enum import IntEnum
from typing import Optional

from ax.analysis.analysis import AnalysisCard
from ax.core.experiment import Experiment
from ax.modelbridge.generation_strategy import GenerationStrategy


class HealthcheckStatus(IntEnum):
PASS = 0
FAIL = 1
WARNING = 2


class HealthcheckAnalysisCard(AnalysisCard):
blob_annotation = "healthcheck"

def get_status(self) -> HealthcheckStatus:
return HealthcheckStatus(json.loads(self.blob)["status"])


class HealthcheckAnalysis:
"""
An analysis that performs a health check.
"""

def compute(
self,
experiment: Optional[Experiment] = None,
generation_strategy: Optional[GenerationStrategy] = None,
) -> HealthcheckAnalysisCard: ...

0 comments on commit da3f3c1

Please sign in to comment.