class_docstr: Used by the benchmark runner to track outstanding jobs.
  This class handles bookkeeping and timeout + retry logic.
class_docstr_tok: ["Used","by","the","benchmark","runner","to","track","outstanding","jobs",".","This","class","handles","bookkeeping","and","timeout","+","retry","logic","."]
code: def check_finished(self) -> bool:
      if self._proc.poll() is not None:
          return True
  
      timeout = self.work_order.timeout
      if timeout is None or self._proc.duration < timeout:
          return False
  
      self._timeouts += 1
      max_attempts = (self._work_order.retries or 0) + 1
      if self._timeouts < max_attempts:
          print(
              f"\nTimeout: {self._work_order.label}, {self._work_order.autolabels} "
              f"(Attempt {self._timeouts} / {max_attempts})"
          )
          self._proc.interrupt()
          self._proc = self._proc.clone()
          return False
  
      raise subprocess.TimeoutExpired(
          cmd=self._proc.cmd, timeout=timeout
      )
  
imports: import dataclasses
  import json
  import os
  import pickle
  import signal
  import subprocess
  import time
  import uuid
  from typing import List, Optional, TYPE_CHECKING, Union
  from core.api import AutoLabels
  from core.types import Label
  from core.utils import get_temp_dir
  from worker.main import WORKER_PATH, WorkerFailure, WorkerOutput, WorkerTimerArgs, WorkerUnpickler
label_desc: Use image node_id 6 for calling the InProgress obj's underlying member method code with example usage: obj.check_finished() and returns: True, False, False