class_docstr: Manages a Mongo-DB for storing metrics and delivering parameters to trials.
  
  The Mongo-DB contains one database that serves as a queue of future trials
  and one to store results of active and finished trials.
  
  Attributes:
      dbpath (str): the path where Mongo-DB stores its files.
      port (int): the port on which the Mongo-DB should run.
      reinstantiated (bool): whether an instance of the MongoDB is being loaded.
      mongodb_args (dict): keyword arguments to MongoDB
class_docstr_tok: ["Manages","a","Mongo-DB","for","storing","metrics","and","delivering","parameters","to","trials",".","The","Mongo-DB","contains","one","database","that","serves","as","a","queue","of","future","trials","and","one","to","store","results","of","active","and","finished","trials",".","Attributes",":","dbpath","(","str",")",":","the","path","where","Mongo-DB","stores","its","files",".","port","(","int",")",":","the","port","on","which","the","Mongo-DB","should","run",".","reinstantiated","(","bool",")",":","whether","an","instance","of","the","MongoDB","is","being","loaded",".","mongodb_args","(","dict",")",":","keyword","arguments","to","MongoDB"]
docstr: Runs the DB in a sub-process.
docstr_tok: ["Runs","the","DB","in","a","sub-process","."]
code: def start(self):
      """
      Runs the DB in a sub-process.
      """
  
      args = {"--" + k: v for k, v in self.mongodb_args.items()}
      if "--dbpath" in args:
          warnings.warn(
              "Writing MongoDB to custom path {} instead of "
              "output dir {}".format(args["--dbpath"], self.dir),
              UserWarning,
          )
      else:
          args["--dbpath"] = self.dir
      if "--logpath" in args:
          warnings.warn(
              "Writing MongoDB logs to custom path {} instead of "
              "output dir {}".format(
                  args["--logpath"], os.path.join(self.dir, "log.txt")
              ),
              UserWarning,
          )
      else:
          args["--logpath"] = os.path.join(self.dir, "log.txt")
      if "--port" in args:
          warnings.warn(
              "Starting MongoDB on port {} instead of "
              "port {}. Set port via the db_port argument in "
              "sherpa.optimize".format(args["--port"], self.port),
              UserWarning,
          )
      else:
          args["--port"] = str(self.port)
  
      dblogger.debug(
          "Starting MongoDB...\nDIR:\t{}\nADDRESS:\t{}:{}".format(
              self.dir, socket.gethostname(), self.port
          )
      )
      cmd = ["mongod"]
      cmd += [
          str(item)
          for keyvalue in args.items()
          for item in keyvalue
          if item is not ""
      ]
  
      dblogger.debug(
          "Starting MongoDB using command:{}".format(str(cmd))
      )
  
      try:
          self.mongo_process = subprocess.Popen(cmd)
      except FileNotFoundError as e:
          raise FileNotFoundError(
              str(e) + "\nCheck that MongoDB is installed and in PATH."
          )
      time.sleep(1)
      self.check_db_status()
      if self.reinstantiated:
          self.get_new_results()
  
imports: import logging
  import numpy
  import pymongo
  from pymongo import MongoClient
  import subprocess
  import time
  import os
  import socket
  import warnings
  import sherpa
label_desc: Use image node_id 3 for calling the _Database obj's underlying member method code with example usage: obj.start() without return types