class_docstr: Abstract class for trainable models, functions, etc.
  
  A call to ``train()`` on a trainable will execute one logical iteration of
  training. As a rule of thumb, the execution time of one train call should
  be large enough to avoid overheads (i.e. more than a few seconds), but
  short enough to report progress periodically (i.e. at most a few minutes).
  
  Calling ``save()`` should save the training state of a trainable to disk,
  and ``restore(path)`` should restore a trainable to the given state.
  
  Generally you only need to implement ``setup``, ``step``,
  ``save_checkpoint``, and ``load_checkpoint`` when subclassing Trainable.
  
  Other implementation methods that may be helpful to override are
  ``log_result``, ``reset_config``, ``cleanup``, and ``_export_model``.
  
  Tune will convert this class into a Ray actor, which runs on a separate process.
  By default, Tune will also change the current working directory of this process to
  its corresponding trial-level log directory ``self.logdir``.
  This is designed so that different trials that run on the same physical node won't
  accidentally write to the same location and overstep each other.
  
  The behavior of changing the working directory can be disabled by setting the
  `RAY_CHDIR_TO_TRIAL_DIR=0` environment variable. This allows access to files
  in the original working directory, but relative paths should be used for read only
  purposes, and you must make sure that the directory is synced on all nodes if
  running on multiple machines.
  
  The `TUNE_ORIG_WORKING_DIR` environment variable was the original workaround for
  accessing paths relative to the original working directory. This environment
  variable is deprecated, and the `RAY_CHDIR_TO_TRIAL_DIR` environment variable
  described above should be used instead.
  
  This class supports checkpointing to and restoring from remote storage.
docstr: Releases all resources used by this trainable.
  
  Calls ``Trainable.cleanup`` internally. Subclasses should override
  ``Trainable.cleanup`` for custom cleanup procedures.
docstr_tok: ["Releases","all","resources","used","by","this","trainable",".","Calls","``","Trainable.cleanup","``","internally",".","Subclasses","should","override","``","Trainable.cleanup","``","for","custom","cleanup","procedures","."]
code: def stop(self):
      """Releases all resources used by this trainable.
  
      Calls ``Trainable.cleanup`` internally. Subclasses should override
      ``Trainable.cleanup`` for custom cleanup procedures.
      """
      self._result_logger.flush()
      self._result_logger.close()
      if self._monitor.is_alive():
          self._monitor.stop()
          self._monitor.join()
      self.cleanup()
  
      self._close_logfiles()
  
imports: import copy
  from datetime import datetime
  import logging
  import os
  from pathlib import Path
  import platform
  import sys
  import tempfile
  import time
  from contextlib import redirect_stderr, redirect_stdout
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
  import ray
  import ray.cloudpickle
  from ray.air._internal.util import skip_exceptions, exception_cause
  from ray.air.constants import TIMESTAMP, TIME_THIS_ITER_S, TRAINING_ITERATION
  from ray.train._internal.checkpoint_manager import _TrainingResult
  from ray.train._internal.storage import StorageContext, _exists_at_fs_path
  from ray.train import Checkpoint
  from ray.tune.result import DEBUG_METRICS, DEFAULT_RESULTS_DIR, DONE, EPISODES_THIS_ITER, EPISODES_TOTAL, HOSTNAME, NODE_IP, PID, RESULT_DUPLICATE, SHOULD_CHECKPOINT, STDERR_FILE, STDOUT_FILE, TIME_TOTAL_S, TIMESTEPS_THIS_ITER, TIMESTEPS_TOTAL, TRIAL_ID, TRIAL_INFO
  from ray.tune.utils import UtilMonitor
  from ray.tune.utils.log import disable_ipython
  from ray.tune.utils.util import Tee
  from ray.tune.execution.placement_groups import PlacementGroupFactory
  from ray.util.annotations import DeveloperAPI, PublicAPI
label_desc: Use image node_id 19 for calling the Trainable obj's underlying member method code with example usage: obj.stop() without return types