class_docstr: Stops all trials after a certain timeout.
  
  This stopper is automatically created when the `time_budget_s`
  argument is passed to `train.RunConfig()`.
  
  Args:
      timeout: Either a number specifying the timeout in seconds, or
          a `datetime.timedelta` object.
code: def __init__(self, timeout: Union[int, float, datetime.timedelta]):
      from datetime import timedelta
  
      if isinstance(timeout, timedelta):
          self._timeout_seconds = timeout.total_seconds()
      elif isinstance(timeout, (int, float)):
          self._timeout_seconds = timeout
      else:
          raise ValueError(
              "`timeout` parameter has to be either a number or a "
              "`datetime.timedelta` object. Found: {}".format(
                  type(timeout)
              )
          )
  
      self._budget = self._timeout_seconds
  
      # To account for setup overhead, set the last check time only after
      # the first call to `stop_all()`.
      self._last_check = None
  
file_path: ray/python/ray/tune/stopper/timeout.py
imports: import datetime
  from typing import Union
  import time
  from ray import logger
  from ray.util.annotations import PublicAPI
  from ray.tune.stopper.stopper import Stopper
label_desc: Use image node_id 1 to create a new TimeoutStopper object from inherited base classes: Stopper with example: obj = TimeoutStopper(timeout)