Utility Functions¶
- es_wait.utils.diagnosis_generator(ind: str, data: Sequence) Generator¶
Yield diagnosis strings from the provided data :param data: The list from health_report[‘indicators’][ind][‘diagnosis’] :type data: list
- es_wait.utils.impact_generator(ind: str, data: Sequence) Generator¶
Yield impact strings from the provided data :param data: The list from health_report[‘indicators’][ind][‘impact’] :type data: list
- es_wait.utils.indicator_generator(ind: str, data: Dict) Generator¶
Yield symptom, details, and impacts and diagnosis strings for any indicators :param data: Data from health_report[‘indicators’][ind] :type data: dict
- es_wait.utils.healthchk_result(data: ObjectApiResponse, check_for: HealthCheckDict) bool¶
Check the health check data from
client.health_check().If multiple keys are provided in check_for, all must key/value pairs must match for a
Trueresponse.If the expected response(s) are in the data, return True, otherwise False. Debug log the results.
- Parameters:
data (
ObjectApiResponse) – The health check datacheck_for (HealthCheckDict) – The expected response
- Returns:
True if the expected response is in the data, otherwise False
- Return type:
- es_wait.utils.health_report(data: ObjectApiResponse) None¶
Log the health report data from
client.health_report().- Parameters:
data (
ObjectApiResponse) – The health report data
- es_wait.utils.loop_health_indicators(inds: Dict) None¶
Loop through the indicators and log the data :param inds: The health report indicators :type inds: dict
- es_wait.utils.prettystr(*args, **kwargs) str¶
A (nearly) straight up wrapper for
pprint.pformat(), except that we provide our own default values for indent (2) and sort_dicts (False). Primarily for debug logging and showing more readable dictionaries.‘Return the formatted representation of object as a string. indent, width, depth, compact, sort_dicts and underscore_numbers are passed to the PrettyPrinter constructor as formatting parameters’ (from pprint documentation).