class_docstr: Tune base callback that can be extended and passed to a ``TrialRunner``
  
  Tune callbacks are called from within the ``TrialRunner`` class. There are
  several hooks that can be used, all of which are found in the submethod
  definitions of this base class.
  
  The parameters passed to the ``**info`` dict vary between hooks. The
  parameters passed are described in the docstrings of the methods.
  
  This example will print a metric each time a result is received:
  
  .. testcode::
  
      from ray import train, tune
      from ray.tune import Callback
  
  
      class MyCallback(Callback):
          def on_trial_result(self, iteration, trials, trial, result,
                              **info):
              print(f"Got result: {result['metric']}")
  
  
      def train_func(config):
          for i in range(10):
              tune.report(metric=i)
  
      tuner = tune.Tuner(
          train_func,
          run_config=train.RunConfig(
              callbacks=[MyCallback()]
          )
      )
      tuner.fit()
  
  .. testoutput::
      :hide:
  
      ...
class_docstr_tok: ["Tune","base","callback","that","can","be","extended","and","passed","to","a","``","TrialRunner","``","Tune","callbacks","are","called","from","within","the","``","TrialRunner","``","class",".","There","are","several","hooks","that","can","be","used",",","all","of","which","are","found","in","the","submethod","definitions","of","this","base","class",".","The","parameters","passed","to","the","``","*","*","info","``","dict","vary","between","hooks",".","The","parameters","passed","are","described","in","the","docstrings","of","the","methods",".","This","example","will","print","a","metric","each","time","a","result","is","received",":","..","testcode",":",":","from","ray","import","train",",","tune","from","ray.tune","import","Callback","class","MyCallback","(","Callback",")",":","def","on_trial_result","(","self",",","iteration",",","trials",",","trial",",","result",",","*","*","info",")",":","print","(","f","''","Got","result",":","{","result","[","'metric","'","]","}","''",")","def","train_func","(","config",")",":","for","i","in","range","(","10",")",":","tune.report","(","metric=i",")","tuner","=","tune.Tuner","(","train_func",",","run_config=train.RunConfig","(","callbacks=","[","MyCallback","(",")","]",")",")","tuner.fit","(",")","..","testoutput",":",":",":","hide",":","..."]
docstr: Set the state of the callback.
  
  This method should be implemented by subclasses to restore the callback's
  state based on the given dict state.
  
  This is used automatically by Tune to restore checkpoint callback state
  on :ref:`Tune experiment restoration <tune-experiment-level-fault-tolerance>`.
  
  See :meth:`~ray.tune.Callback.get_state` for an example implementation.
  
  Args:
      state: State of the callback.
docstr_tok: ["Set","the","state","of","the","callback",".","This","method","should","be","implemented","by","subclasses","to","restore","the","callback's","state","based","on","the","given","dict","state",".","This","is","used","automatically","by","Tune","to","restore","checkpoint","callback","state","on",":","ref",":","`","Tune","experiment","restoration","<","tune-experiment-level-fault-tolerance",">","`",".","See",":","meth",":","`","~ray.tune.Callback.get_state","`","for","an","example","implementation",".","Args",":","state",":","State","of","the","callback","."]
code: def set_state(self, state: Dict):
      """Set the state of the callback.
  
      This method should be implemented by subclasses to restore the callback's
      state based on the given dict state.
  
      This is used automatically by Tune to restore checkpoint callback state
      on :ref:`Tune experiment restoration <tune-experiment-level-fault-tolerance>`.
  
      See :meth:`~ray.tune.Callback.get_state` for an example implementation.
  
      Args:
          state: State of the callback.
      """
      pass
  
imports: from abc import ABCMeta
  import glob
  import os
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
  import warnings
  from ray.util.annotations import PublicAPI, DeveloperAPI
  from ray.tune.utils.util import _atomic_save, _load_newest_checkpoint
label_desc: Use image node_id 14 for calling the Callback obj's underlying member method code with example usage: obj.set_state(state) without return types