-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Add abstract class for health checks Reviewed By: mpolson64 Differential Revision: D60417357
- Loading branch information
1 parent
e1fd26a
commit da3f3c1
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |