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: Puts a new trial in the queue for trial scripts to get.
docstr_tok: ["Puts","a","new","trial","in","the","queue","for","trial","scripts","to","get","."]
code: def enqueue_trial(self, trial):
      """
      Puts a new trial in the queue for trial scripts to get.
      """
      self.check_db_status()
      trial = {"trial_id": trial.id, "parameters": trial.parameters}
      try:
          t_id = self.db.trials.insert_one(trial).inserted_id
      except pymongo.errors.InvalidDocument:
          new_params = {}
          for k, v in trial["parameters"].items():
              if isinstance(v, numpy.int64):
                  v = int(v)
  
              new_params[k] = v
  
          trial["parameters"] = new_params
          t_id = self.db.trials.insert_one(trial).inserted_id
  
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 6 for calling the _Database obj's underlying member method code with example usage: obj.enqueue_trial(trial) without return types