Skip to content

Commit

Permalink
Healthcheck analysis class (#2646)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2646

Add abstract class for health checks

Reviewed By: mpolson64

Differential Revision: D60417357

fbshipit-source-id: 47beb0aeaafd60acd5ba2bf3a8b8cb9674587529
  • Loading branch information
Cesar-Cardoso authored and facebook-github-bot committed Aug 8, 2024
1 parent c9468b5 commit 6afa678
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 6afa678

Please sign in to comment.