Skip to content

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
def __init__(self, stop_file_path: str):
    self.stop_file_path = stop_file_path

Attributes

stop_file_path = stop_file_path instance-attribute

Functions

__call__(gepa_state: GEPAState) -> bool

Source code in gepa/utils/stop_condition.py
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
def remove_stop_file(self):
    # remove the stop file
    if os.path.exists(self.stop_file_path):
        os.remove(self.stop_file_path)