class_docstr: A DataStore which relies on the GraphManager check pointing methods to communicate policies.
class_docstr_tok: ["A","DataStore","which","relies","on","the","GraphManager","check","pointing","methods","to","communicate","policies","."]
docstr: :param require_new_policy: if True, only load a policy if it hasn't been loaded in this
  process yet before.
  :param timeout: Will only try to load the policy once if timeout is None, otherwise will
  retry for timeout seconds
docstr_tok: [":","param","require_new_policy",":","if","True",",","only","load","a","policy","if","it","has","n't","been","loaded","in","this","process","yet","before",".",":","param","timeout",":","Will","only","try","to","load","the","policy","once","if","timeout","is","None",",","otherwise","will","retry","for","timeout","seconds"]
code: def _new_policy_exists(
      self, require_new_policy=True, timeout=None
  ) -> bool:
      """
      :param require_new_policy: if True, only load a policy if it hasn't been loaded in this
      process yet before.
      :param timeout: Will only try to load the policy once if timeout is None, otherwise will
      retry for timeout seconds
      """
      checkpoint_state_reader = CheckpointStateReader(
          self.checkpoint_dir, checkpoint_state_optional=False
      )
      checkpoint = "first"
      if timeout is None:
          timeout = 0
      timeout_ends = time.time() + timeout
      while time.time() < timeout_ends or checkpoint == "first":
          if self.end_of_policies():
              return False
  
          self.load_from_store()
  
          checkpoint = checkpoint_state_reader.get_latest()
          if checkpoint is not None:
              if (
                  not require_new_policy
                  or checkpoint.num > self.checkpoint_num
              ):
                  self.checkpoint_num = checkpoint.num
                  return True
  
      raise ValueError(
          "Waited for {timeout} seconds, but no first policy was received.".format(
              timeout=timeout
          )
      )
  
file_path: coach/rl_coach/data_stores/checkpoint_data_store.py
imports: import time
  import os
  from rl_coach.checkpoint import CheckpointStateReader
  from rl_coach.data_stores.data_store import SyncFiles
label_desc: Use image node_id 5 for calling the CheckpointDataStore obj's underlying member method code with example usage: obj._new_policy_exists(require_new_policy, timeout) and returns: False, True