Waiter Class

Waiter

This is the parent class for all other classes.

class es_wait._base.Waiter(client: Elasticsearch, pause: float = 9.0, timeout: float = 15.0, max_exceptions: int = 10)

Bases: object

Waiter Parent Class

add_exception(value: Exception) None

This method appends value the exceptions list.

Parameters:

value (Exception) – An exception to add

announce() None

This method is called when the Waiter class is initialized. It logs a level 1 debug message using waitstr.

check() bool

This will be redefined by each child class

Getter:

Returns if the check was complete

Type:

bool

client

An Elasticsearch client instance

do_health_report

Only changes to True in certain circumstances

property exception_count_msg: str

This property returns a messgage showing the current number of exceptions raised and the maximum number of exceptions allowed.

Getter:

Returns ‘X exceptions raised out of Y allowed’

Type:

str

property exceptions: list

This property returns a list of exceptions raised during the wait.

Getter:

Returns a list of exceptions raised

Type:

list

exceptions_raised

The number of exceptions raised

max_exceptions

The maximum number of exceptions to allow

pause

The delay between checks for completion

timeout

The number of seconds before giving up. -1 means no timeout.

too_many_exceptions() None

If the number of exceptions raised is greater than or equal to the maximum number of exceptions allowed, then a ExceptionCount will be raised.

wait(frequency: int = 5) None

This method is where the actual waiting occurs. Depending on what frequency is set to, you should see non-DEBUG level logs no more than every frequency seconds.

If timeout has been reached without check() returning as True, then a TimeoutError will be raised.

If check() returns False, then the method will wait pause seconds before calling check() again.

Elapsed time will be logged every frequency seconds, when check() is True, or when timeout is reached.

If do_health_report is True, then call client.health_report() and pass the results to utils.health_report().

Parameters:

frequency – The number of seconds between log reports on progress.