class_docstr: Legacy protocol, store all experiments and trials inside the Database()
  
  Parameters
  ----------
  config: Dict
      configuration definition passed from experiment_builder
      to storage factory to legacy constructor.
      See `~orion.io.database.Database` for more details
  setup: bool
      Setup the database (create indexes)
class_docstr_tok: ["Legacy","protocol",",","store","all","experiments","and","trials","inside","the","Database","(",")","Parameters","--","--","--","--","--","config",":","Dict","configuration","definition","passed","from","experiment_builder","to","storage","factory","to","legacy","constructor",".","See","`","~orion.io.database.Database","`","for","more","details","setup",":","bool","Setup","the","database","(","create","indexes",")"]
docstr: See :func:`orion.storage.base.BaseStorageProtocol.create_experiment`
docstr_tok: ["See",":","func",":","`","orion.storage.base.BaseStorageProtocol.create_experiment","`"]
code: def create_experiment(
      self, config, algo_locked=0, algo_state=None, algo_heartbeat=None
  ):
      """See :func:`orion.storage.base.BaseStorageProtocol.create_experiment`"""
      exp_rval = self._db.write("experiments", data=config, query=None)
      self.write_algorithm_lock(
          experiment_id=config["_id"],
          algorithm_config=config.get("algorithm", {}),
          locked=algo_locked,
          state=algo_state,
          heartbeat=algo_heartbeat,
      )
      return exp_rval
  
imports: import contextlib
  import datetime
  import logging
  import pickle
  import time
  import orion.core
  import orion.core.utils.backward
  from orion.core.io.database import Database, OutdatedDatabaseError, database_factory
  from orion.core.worker.trial import Trial, validate_status
  from orion.storage.base import BaseStorageProtocol, FailedUpdate, LockAcquisitionTimeout, LockedAlgorithmState, get_trial_uid_and_exp, get_uid
label_desc: Use image node_id 6 for calling the Legacy obj's underlying member method code with example usage: obj.create_experiment(config, algo_locked, algo_state, algo_heartbeat) and returns: exp_rval