code: def log_once(key):
      """Returns True if this is the "first" call for a given key.
  
      Various logging settings can adjust the definition of "first".
  
      Example:
  
          .. testcode::
  
              import logging
              from ray.util.debug import log_once
  
              logger = logging.getLogger(__name__)
              if log_once("some_key"):
                  logger.info("Some verbose logging statement")
      """
  
      global _last_logged
  
      if _disabled:
          return False
      elif key not in _logged:
          _logged.add(key)
          _last_logged = time.time()
          return True
      elif _periodic_log and time.time() - _last_logged > 60.0:
          _logged.clear()
          _last_logged = time.time()
          return False
      else:
          return False
  
file_path: ray/python/ray/util/debug.py
imports: from collections import defaultdict, namedtuple
  import gc
  import os
  import re
  import time
  import tracemalloc
  from typing import Callable, List, Optional
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 for calling a global function with example usage: log_once(key) and returns: False, True, False, False