class_docstr: ExperimentClient providing all functionalities for the python API
  
  Note that the ExperimentClient is not meant to be instantiated by the user.
  Look at `orion.client.create_experiment` to build an ExperimentClient.
  
  Parameters
  ----------
  experiment: `orion.core.worker.experiment.Experiment`
      Experiment object serving for interaction with storage
class_docstr_tok: ["ExperimentClient","providing","all","functionalities","for","the","python","API","Note","that","the","ExperimentClient","is","not","meant","to","be","instantiated","by","the","user",".","Look","at","`","orion.client.create_experiment","`","to","build","an","ExperimentClient",".","Parameters","--","--","--","--","--","experiment",":","`","orion.core.worker.experiment.Experiment","`","Experiment","object","serving","for","interaction","with","storage"]
docstr: Release a trial.
  
  Release the reservation and stop the heartbeat.
  
  Experiment must be in writable ('w') or executable ('x') mode.
  
  Parameters
  ----------
  trial: `orion.core.worker.trial.Trial`
      Trial to reserve.
  status: str, optional
      Set the trial to given status while releasing the reservation.
      Defaults to 'interrupted'.
  
  Raises
  ------
  `RuntimeError`
      If reservation of the trial has been lost prior to releasing it.
  `AlreadyReleased`
      If reservation of trial was already released
  `ValueError`
      If the trial does not exist in storage.
  `orion.core.utils.exceptions.UnsupportedOperation`
      If the experiment was not loaded in writable mode.
docstr_tok: ["Release","a","trial",".","Release","the","reservation","and","stop","the","heartbeat",".","Experiment","must","be","in","writable","(","'","w","'",")","or","executable","(","'","x","'",")","mode",".","Parameters","--","--","--","--","--","trial",":","`","orion.core.worker.trial.Trial","`","Trial","to","reserve",".","status",":","str",",","optional","Set","the","trial","to","given","status","while","releasing","the","reservation",".","Defaults","to","'interrupted","'",".","Raises","--","--","--","`","RuntimeError","`","If","reservation","of","the","trial","has","been","lost","prior","to","releasing","it",".","`","AlreadyReleased","`","If","reservation","of","trial","was","already","released","`","ValueError","`","If","the","trial","does","not","exist","in","storage",".","`","orion.core.utils.exceptions.UnsupportedOperation","`","If","the","experiment","was","not","loaded","in","writable","mode","."]
code: def release(self, trial, status="interrupted"):
      """Release a trial.
  
      Release the reservation and stop the heartbeat.
  
      Experiment must be in writable ('w') or executable ('x') mode.
  
      Parameters
      ----------
      trial: `orion.core.worker.trial.Trial`
          Trial to reserve.
      status: str, optional
          Set the trial to given status while releasing the reservation.
          Defaults to 'interrupted'.
  
      Raises
      ------
      `RuntimeError`
          If reservation of the trial has been lost prior to releasing it.
      `AlreadyReleased`
          If reservation of trial was already released
      `ValueError`
          If the trial does not exist in storage.
      `orion.core.utils.exceptions.UnsupportedOperation`
          If the experiment was not loaded in writable mode.
  
      """
      self._check_if_writable()
  
      current_status = trial.status
      raise_if_unreserved = True
      try:
          self._experiment.set_trial_status(
              trial, status, was="reserved"
          )
          self._producer.observe(trial)
      except FailedUpdate as e:
          if self.get_trial(trial) is None:
              raise ValueError(
                  f"Trial {trial.id} does not exist in database."
              ) from e
          if current_status != "reserved":
              raise_if_unreserved = False
              raise AlreadyReleased(
                  f"Trial {trial.id} was already released locally."
              ) from e
  
          raise RuntimeError(
              f"Reservation for trial {trial.id} has been lost before release."
          ) from e
      finally:
          self._release_reservation(
              trial, raise_if_unreserved=raise_if_unreserved
          )
  
imports: from __future__ import annotations
  import inspect
  import logging
  import numbers
  import typing
  from contextlib import contextmanager
  from typing import Callable
  import orion.core
  from orion.algo.space import Space
  from orion.client.runner import Runner, prepare_trial_working_dir
  from orion.core.io.database import DuplicateKeyError
  from orion.core.utils.exceptions import BrokenExperiment, CompletedExperiment, ReservationRaceCondition, UnsupportedOperation, WaitingForTrials
  from orion.core.utils.format_trials import dict_to_trial
  from orion.core.utils.working_dir import SetupWorkingDir
  from orion.core.worker.experiment import AlgoT
  from orion.core.worker.producer import Producer
  from orion.core.worker.trial import AlreadyReleased, Trial, TrialCM
  from orion.core.worker.trial_pacemaker import TrialPacemaker
  from orion.executor.base import BaseExecutor, executor_factory
  from orion.plotting.base import PlotAccessor
  from orion.storage.base import FailedUpdate
label_desc: Use image node_id 31 for calling the ExperimentClient obj's underlying member method code with example usage: obj.release(trial, status) without return types