The Python function `TimeoutSampler.wait_for_func_status` is a utility method in the `ocs_ci.utility.utils` module. It is designed to wait for a specific status or condition to be met within a given time frame. This function takes a function as input, along with optional arguments, and continuously evaluates the function until a desired status is obtained or a timeout occurs.
The function wraps an internal loop that repeatedly calls the provided function until either it returns a value that matches the expected status or the specified timeout is reached. If the function returns the expected status within the timeout period, the loop is terminated, and the function returns the result. Otherwise, if the timeout period elapses without obtaining the expected status, an exception is raised.
This utility function is commonly used in scenarios where there is a need to wait for a specific condition or status to be achieved before proceeding with further actions or assertions in a script or program. It provides a convenient way to handle timeouts and ensures that the script does not hang indefinitely while waiting for a condition that may never be met.
Python TimeoutSampler.wait_for_func_status - 30 examples found. These are the top rated real world Python examples of ocs_ci.utility.utils.TimeoutSampler.wait_for_func_status extracted from open source projects. You can rate examples to help us improve the quality of examples.