OpenHands/openhands/runtime/utils/tenacity_stop.py
Xingyao Wang da548d308c
[agent] LLM-based editing (#3985)
Co-authored-by: Tim O'Farrell <tofarr@gmail.com>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Co-authored-by: Robert Brennan <accounts@rbren.io>
Co-authored-by: Graham Neubig <neubig@gmail.com>
2024-10-22 04:51:44 +08:00

13 lines
320 B
Python

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