INNER CODE UNIT · Python

request_stop

lij768423-svg/grok-register-panel · batch_supervisor.py:230

    def request_stop(_signum, _frame):
        nonlocal stop_requested
        stop_requested = True

    can_install_signals = threading.current_thread() is threading.main_thread()
    previous_handlers: dict[int, object] = {}
    if can_install_signals:
        for signum in (signal.SIGINT, signal.SIGTERM):
            previous_handlers[signum] = signal.getsignal(signum)
            signal.signal(signum, request_stop)

    try:
        while not stop_requested:
            completed = read_completed(progress_path)
            remaining = max(0, target - completed)
            if remaining <= 0:
                print(
                    f"[supervisor] batch complete completed={completed}/{target} restarts={restarts}",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…