class_docstr: Triggers `policy_saver` save calls in a separate thread asynchronously.
class_docstr_tok: ["Triggers","`","policy_saver","`","save","calls","in","a","separate","thread","asynchronously","."]
docstr: Helper method for the saving thread to wait and execute save requests.
docstr_tok: ["Helper","method","for","the","saving","thread","to","wait","and","execute","save","requests","."]
code: def _save_loop(self):
      """Helper method for the saving thread to wait and execute save requests."""
      while True:
          with self._save_condition_variable:
              while not self._export_dir:
                  self._save_condition_variable.wait()
                  if self._join_save_thread:
                      return
              if self._saving_checkpoint:
                  logging.info(
                      "Saving checkpoint to %s", self._export_dir
                  )
                  self._policy_saver.save_checkpoint(self._export_dir)
              else:
                  logging.info("Saving policy to %s", self._export_dir)
                  self._policy_saver.save(self._export_dir)
              self._export_dir = None
              self._save_condition_variable.notify()
  
file_path: agents/tf_agents/policies/async_policy_saver.py
imports: import threading
  from typing import Text
  from absl import logging
  from tf_agents.policies import policy_saver
label_desc: Use image node_id 2 for calling the AsyncPolicySaver obj's underlying member method code with example usage: obj._save_loop() without return types