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 save method, generalizes over save and save_checkpoint.
docstr_tok: ["Helper","save","method",",","generalizes","over","save","and","save_checkpoint","."]
code: def _save(self, export_dir, saving_checkpoint, blocking):
      """Helper save method, generalizes over save and save_checkpoint."""
      self._assert_save_thread_is_alive()
  
      if blocking:
          with self._save_condition_variable:
              while self._export_dir:
                  logging.info(
                      "Waiting for AsyncPolicySaver to finish."
                  )
                  self._save_condition_variable.wait()
              if saving_checkpoint:
                  self._policy_saver.save_checkpoint(export_dir)
              else:
                  self._policy_saver.save(export_dir)
          return
  
      if not self._save_condition_variable.acquire(blocking=False):
          logging.info(
              "AsyncPolicySaver save is still in progress skipping save."
          )
          return
      try:
          self._saving_checkpoint = saving_checkpoint
          self._export_dir = export_dir
          self._save_condition_variable.notify()
      finally:
          self._save_condition_variable.release()
  
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 6 for calling the AsyncPolicySaver obj's underlying member method code with example usage: obj._save(export_dir, saving_checkpoint, blocking) without return types