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.set_trial_status`
docstr_tok: ["See",":","func",":","`","orion.storage.base.BaseStorageProtocol.set_trial_status","`"]
code: def set_trial_status(self, trial, status, heartbeat=None, was=None):
      """See :func:`orion.storage.base.BaseStorageProtocol.set_trial_status`"""
      heartbeat = heartbeat or datetime.datetime.utcnow()
      was = was or trial.status
  
      validate_status(status)
      validate_status(was)
  
      update = dict(
          status=status,
          heartbeat=heartbeat,
          experiment=trial.experiment,
      )
  
      rc = self.update_trial(
          trial,
          uid=None,
          experiment_uid=None,
          **update,
          where={"status": was},
      )
  
      if not rc:
          raise FailedUpdate()
  
      trial.status = status
  
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 20 for calling the Legacy obj's underlying member method code with example usage: obj.set_trial_status(trial, status, heartbeat, was) without return types