FileStopper
gepa.utils.stop_condition.FileStopper(stop_file_path: str)
Bases: StopperProtocol
Stop callback that stops when a specific file exists.
Source code in gepa/utils/stop_condition.py
text
def __init__(self, stop_file_path: str):
self.stop_file_path = stop_file_pathAttributes
stop_file_path = stop_file_path instance-attribute
Methods:
__call__(gepa_state: GEPAState) -> bool
Source code in gepa/utils/stop_condition.py
text
def __call__(self, gepa_state: GEPAState) -> bool:
# returns true if stop file exists
return os.path.exists(self.stop_file_path)remove_stop_file()
Source code in gepa/utils/stop_condition.py
text
def remove_stop_file(self):
# remove the stop file
if os.path.exists(self.stop_file_path):
os.remove(self.stop_file_path)