-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement memory and disk utilization check, camel case create index …
…API (#657) * Implement memory and disk utilization check * Update create index API to use camelCase * Improve index cache refresh
- Loading branch information
Showing
24 changed files
with
434 additions
and
203 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,33 @@ | ||
from typing import Optional | ||
|
||
from marqo.base_model import StrictBaseModel | ||
|
||
|
||
class InferenceHealthResponse(StrictBaseModel): | ||
status: str | ||
|
||
|
||
class BackendHealthResponse(StrictBaseModel): | ||
status: str | ||
memoryIsAvailable: Optional[bool] | ||
storageIsAvailable: Optional[bool] | ||
|
||
|
||
class HealthResponse(StrictBaseModel): | ||
status: str | ||
inference: InferenceHealthResponse | ||
backend: BackendHealthResponse | ||
|
||
@classmethod | ||
def from_marqo_health_status(cls, marqo_health_status): | ||
return cls( | ||
status=marqo_health_status.status.value, | ||
inference=InferenceHealthResponse( | ||
status=marqo_health_status.inference.status.value | ||
), | ||
backend=BackendHealthResponse( | ||
status=marqo_health_status.backend.status.value, | ||
memoryIsAvailable=marqo_health_status.backend.memory_is_available, | ||
storageIsAvailable=marqo_health_status.backend.storage_is_available | ||
) | ||
) |
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,22 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class MarqoBaseModel(BaseModel): | ||
class Config: | ||
allow_population_by_field_name = True # accept both real name and alias (if present) | ||
validate_assignment = True | ||
|
||
|
||
class StrictBaseModel(MarqoBaseModel): | ||
class Config(MarqoBaseModel.Config): | ||
extra = "forbid" | ||
|
||
|
||
class ImmutableBaseModel(MarqoBaseModel): | ||
class Config(MarqoBaseModel.Config): | ||
allow_mutation = False | ||
|
||
|
||
class ImmutableStrictBaseModel(StrictBaseModel, ImmutableBaseModel): | ||
class Config(StrictBaseModel.Config, ImmutableBaseModel.Config): | ||
pass |
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
from marqo.core.models.strict_base_model import StrictBaseModel | ||
from typing import Optional | ||
|
||
from marqo.base_model import StrictBaseModel | ||
|
||
|
||
class VespaStats(StrictBaseModel): | ||
memory_used_percentage: Optional[float] | ||
storage_used_percentage: Optional[float] | ||
|
||
|
||
class MarqoIndexStats(StrictBaseModel): | ||
number_of_documents: int | ||
number_of_vectors: int | ||
backend: VespaStats |
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
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.