tenacity_stop.py 320 B

123456789101112
  1. from tenacity import RetryCallState
  2. from tenacity.stop import stop_base
  3. from openhands.runtime.utils.shutdown_listener import should_exit
  4. class stop_if_should_exit(stop_base):
  5. """Stop if the should_exit flag is set."""
  6. def __call__(self, retry_state: "RetryCallState") -> bool:
  7. return should_exit()