Snapshot Class¶
Snapshot¶
- class es_wait.snapshot.Snapshot(client: Elasticsearch, pause: float = 9.0, timeout: float = 7200.0, max_exceptions: int = 10, snapshot: str = '', repository: str = '')¶
Bases:
WaiterWait for a snapshot to complete
- 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¶
Get the state of the snapshot from
snapstate()to determine if the snapshot is complete, and if so, with what status.If the state is
IN_PROGRESS, this method will returnFalse.For all other states, it calls
log_completion()to log the final result. It then returnsTrue.- Getter:
Returns if the check was complete
- Type:
- client¶
An
Elasticsearchclient 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:
- property exceptions: list¶
This property returns a list of exceptions raised during the wait.
- Getter:
Returns a list of exceptions raised
- Type:
- exceptions_raised¶
The number of exceptions raised
- log_completion(state: str) None¶
Log completion based on
stateIf the snapshot state is:
Snapshot States & Logs¶ State
Log Level
Message
SUCCESSINFOSnapshot [name] completed with state SUCCESS.
PARTIALWARNINGSnapshot [name] completed with state PARTIAL.
FAILEDERRORSnapshot [name] completed with state FAILED.
[other]
WARNINGSnapshot [name] completed with state: [other]
- Parameters:
state – The snapshot state
- max_exceptions¶
The maximum number of exceptions to allow
- pause¶
The delay between checks for completion
- repository¶
The repository name
- snapshot¶
The snapshot name
- property snapstate: Dict¶
This function calls
snapshot.get()to get the current state of the snapshot.- Getter:
Returns the state of the snapshot
- Type:
- 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
ExceptionCountwill 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
timeouthas been reached withoutcheck()returning asTrue, then aTimeoutErrorwill be raised.If
check()returnsFalse, then the method will waitpauseseconds before callingcheck()again.Elapsed time will be logged every frequency seconds, when
check()isTrue, or whentimeoutis reached.If
do_health_reportisTrue, then callclient.health_report()and pass the results toutils.health_report().- Parameters:
frequency – The number of seconds between log reports on progress.