class_docstr: Pickled EphemeralDB to support permanancy and concurrency
  
  This is a very simple and inefficient implementation of a permanent database on disk for Oríon.
  The data is loaded from disk for every operation, and every operation is protected with a
  filelock.
  
  Parameters
  ----------
  host: str
      File path to save pickled ephemeraldb.  Default is {user data dir}/orion/orion_db.pkl ex:
      $HOME/.local/share/orion/orion_db.pkl
  timeout: int
      Maximum number of seconds to wait for the lock before raising DatabaseTimeout.
      Default is 60.
class_docstr_tok: ["Pickled","EphemeralDB","to","support","permanancy","and","concurrency","This","is","a","very","simple","and","inefficient","implementation","of","a","permanent","database","on","disk","for","Or\u00edon",".","The","data","is","loaded","from","disk","for","every","operation",",","and","every","operation","is","protected","with","a","filelock",".","Parameters","--","--","--","--","--","host",":","str","File","path","to","save","pickled","ephemeraldb",".","Default","is","{","user","data","dir","}","\/orion\/orion_db.pkl","ex",":","$","HOME\/.local\/share\/orion\/orion_db.pkl","timeout",":","int","Maximum","number","of","seconds","to","wait","for","the","lock","before","raising","DatabaseTimeout",".","Default","is","60","."]
docstr: Lock database file during wrapped operation call.
docstr_tok: ["Lock","database","file","during","wrapped","operation","call","."]
code: def locked_database(self, write=True):
      """Lock database file during wrapped operation call."""
      lock = _create_lock(self.host + ".lock")
  
      try:
          with lock.acquire(timeout=self.timeout):
              database = self._get_database()
  
              yield database
  
              if write:
                  self._dump_database(database)
      except Timeout as e:
          raise DatabaseTimeout(
              TIMEOUT_ERROR_MESSAGE.format(self.timeout)
          ) from e
  
imports: import logging
  import os
  import pickle
  from contextlib import contextmanager
  from pickle import PicklingError
  import psutil
  from filelock import FileLock, SoftFileLock, Timeout
  import orion.core
  from orion.core.io.database import Database, DatabaseTimeout
  from orion.core.io.database.ephemeraldb import EphemeralDB
label_desc: Use image node_id 16 for calling the PickledDB obj's underlying member method code with example usage: obj.locked_database(write) without return types