diff --git a/ax/analysis/healthcheck/__init__.py b/ax/analysis/healthcheck/__init__.py new file mode 100644 index 00000000000..2d99e3e9a0d --- /dev/null +++ b/ax/analysis/healthcheck/__init__.py @@ -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", +] diff --git a/ax/analysis/healthcheck/healthcheck_analysis.py b/ax/analysis/healthcheck/healthcheck_analysis.py new file mode 100644 index 00000000000..c7fd74d025e --- /dev/null +++ b/ax/analysis/healthcheck/healthcheck_analysis.py @@ -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: ...