class_docstr: Implement a generic protocol to allow Orion to communicate using
  different storage backend
class_docstr_tok: ["Implement","a","generic","protocol","to","allow","Orion","to","communicate","using","different","storage","backend"]
docstr: Update the trial status and the heartbeat
  
  Parameters
  ----------
  trial: `Trial` object
      Trial object to update in the database.
  status: str
      Status to be set to the trial
  heartbeat: datetime, optional
      New heartbeat to update simultaneously with status
  was: str, optional
      The status the trial should be set to in the database.
      If None, current ``trial.status`` will be used.
      This is used to ensure coherence in the database, protecting
      against race conditions for instance.
  
  Raises
  ------
  FailedUpdate
      The exception is raised if the status of the trial object
      does not match the status in the database
docstr_tok: ["Update","the","trial","status","and","the","heartbeat","Parameters","--","--","--","--","--","trial",":","`","Trial","`","object","Trial","object","to","update","in","the","database",".","status",":","str","Status","to","be","set","to","the","trial","heartbeat",":","datetime",",","optional","New","heartbeat","to","update","simultaneously","with","status","was",":","str",",","optional","The","status","the","trial","should","be","set","to","in","the","database",".","If","None",",","current","``","trial.status","``","will","be","used",".","This","is","used","to","ensure","coherence","in","the","database",",","protecting","against","race","conditions","for","instance",".","Raises","--","--","--","FailedUpdate","The","exception","is","raised","if","the","status","of","the","trial","object","does","not","match","the","status","in","the","database"]
code: def set_trial_status(
      self,
      trial: Trial,
      status: str,
      heartbeat: datetime | None = None,
      was: str | None = None,
  ):
      """Update the trial status and the heartbeat
  
      Parameters
      ----------
      trial: `Trial` object
          Trial object to update in the database.
      status: str
          Status to be set to the trial
      heartbeat: datetime, optional
          New heartbeat to update simultaneously with status
      was: str, optional
          The status the trial should be set to in the database.
          If None, current ``trial.status`` will be used.
          This is used to ensure coherence in the database, protecting
          against race conditions for instance.
  
      Raises
      ------
      FailedUpdate
          The exception is raised if the status of the trial object
          does not match the status in the database
  
      """
      raise NotImplementedError()
  
imports: from __future__ import annotations
  import contextlib
  import copy
  import logging
  import typing
  from datetime import datetime
  from typing import Literal
  import orion.core
  from orion.core.io import resolve_config
  from orion.core.utils import GenericFactory
label_desc: Use image node_id 18 for calling the BaseStorageProtocol obj's underlying member method code with example usage: obj.set_trial_status(trial, status, heartbeat, was) without return types