harp_apps.proxy.settings.liveness.naive

Inheritance diagram of harp_apps.proxy.settings.liveness.naive

class NaiveLiveness[source]

Bases: BaseLiveness[NaiveLivenessSettings]

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

failure(subject, reason=None)[source]

Returns a boolean indicating if a state change happened.

Parameters:
Return type:

bool

classmethod get_state_of(subject)[source]
Parameters:

subject (LivenessSubject)

Return type:

NaiveLivenessSubjectState

success(subject)[source]

Returns a boolean indicating if a state change happened.

Parameters:

subject (LivenessSubject)

Return type:

bool

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'settings': FieldInfo(annotation=NaiveLivenessSettings, required=True, repr=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class NaiveLivenessSettings[source]

Bases: BaseLivenessSettings

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

build_impl()[source]
failure_threshold: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'failure_threshold': FieldInfo(annotation=int, required=False, default=1, metadata=[Gt(gt=0)]), 'success_threshold': FieldInfo(annotation=int, required=False, default=1, metadata=[Gt(gt=0)]), 'type': FieldInfo(annotation=Literal['naive'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

success_threshold: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])]
type: Literal['naive']
class NaiveLivenessSubjectState[source]

Bases: BaseModel

Holds the internal state of the target subject. Will be attached as an attribute to the said subject, but only used by the liveness implementation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

failure_score: int
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'failure_score': FieldInfo(annotation=int, required=False, default=0), 'success_score': FieldInfo(annotation=int, required=False, default=0)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

success_score: int