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: Observe trial results
  
  Experiment must be in executable ('x') mode.
  
  Parameters
  ----------
  trial: `orion.core.worker.trial.Trial`
      Reserved trial to observe.
  results: list or float
      Results to be set for the new trial. Results must have the format
      {name: <str>: type: <'objective', 'constraint' or 'gradient'>, value=<float>} otherwise
      a ValueError will be raised. If the results are invalid, the trial will not be released.
      If `results` is a float, the result type will be 'objective'.
  name: str
      Name of the result if `results` is a float. Default: 'objective'.
  
  Returns
  -------
  `orion.core.worker.trial.Trial`
      The trial inserted in storage. If `reserve=True` and no results are given, the returned
      trial will be in a `reserved` status.
  
  Raises
  ------
  `ValueError`
      - If results have invalid format
      - If the trial does not exist in storage.
  `RuntimeError`
      If reservation of the trial has been lost prior to releasing it.
  `orion.core.utils.exceptions.UnsupportedOperation`
      If the experiment was not loaded in executable mode.
  `orion.core.utils.exceptions.InvalidResult`
      If the format of trial result is invalid.
docstr_tok: ["Observe","trial","results","Experiment","must","be","in","executable","(","'","x","'",")","mode",".","Parameters","--","--","--","--","--","trial",":","`","orion.core.worker.trial.Trial","`","Reserved","trial","to","observe",".","results",":","list","or","float","Results","to","be","set","for","the","new","trial",".","Results","must","have","the","format","{","name",":","<","str",">",":","type",":","<","'objective","'",",","'constraint","'","or","'gradient","'",">",",","value=","<","float",">","}","otherwise","a","ValueError","will","be","raised",".","If","the","results","are","invalid",",","the","trial","will","not","be","released",".","If","`","results","`","is","a","float",",","the","result","type","will","be","'objective","'",".","name",":","str","Name","of","the","result","if","`","results","`","is","a","float",".","Default",":","'objective","'",".","Returns","--","--","--","-","`","orion.core.worker.trial.Trial","`","The","trial","inserted","in","storage",".","If","`","reserve=True","`","and","no","results","are","given",",","the","returned","trial","will","be","in","a","`","reserved","`","status",".","Raises","--","--","--","`","ValueError","`","-","If","results","have","invalid","format","-","If","the","trial","does","not","exist","in","storage",".","`","RuntimeError","`","If","reservation","of","the","trial","has","been","lost","prior","to","releasing","it",".","`","orion.core.utils.exceptions.UnsupportedOperation","`","If","the","experiment","was","not","loaded","in","executable","mode",".","`","orion.core.utils.exceptions.InvalidResult","`","If","the","format","of","trial","result","is","invalid","."]
code: def observe(
      self,
      trial: Trial,
      results: list[dict] | float,
      name: str = "objective",
  ) -> None:
      """Observe trial results
  
      Experiment must be in executable ('x') mode.
  
      Parameters
      ----------
      trial: `orion.core.worker.trial.Trial`
          Reserved trial to observe.
      results: list or float
          Results to be set for the new trial. Results must have the format
          {name: <str>: type: <'objective', 'constraint' or 'gradient'>, value=<float>} otherwise
          a ValueError will be raised. If the results are invalid, the trial will not be released.
          If `results` is a float, the result type will be 'objective'.
      name: str
          Name of the result if `results` is a float. Default: 'objective'.
  
      Returns
      -------
      `orion.core.worker.trial.Trial`
          The trial inserted in storage. If `reserve=True` and no results are given, the returned
          trial will be in a `reserved` status.
  
      Raises
      ------
      `ValueError`
          - If results have invalid format
          - If the trial does not exist in storage.
      `RuntimeError`
          If reservation of the trial has been lost prior to releasing it.
      `orion.core.utils.exceptions.UnsupportedOperation`
          If the experiment was not loaded in executable mode.
      `orion.core.utils.exceptions.InvalidResult`
          If the format of trial result is invalid.
      """
      self._check_if_executable()
  
      if isinstance(results, numbers.Number):
          results = [dict(value=results, name=name, type="objective")]
  
      trial.results += [Trial.Result(**result) for result in results]
      raise_if_unreserved = True
      try:
          self._experiment.update_completed_trial(trial)
          self._producer.observe(trial)
      except FailedUpdate as e:
          if self.get_trial(trial) is None:
              raise_if_unreserved = False
              raise ValueError(
                  f"Trial {trial.id} does not exist in database."
              ) from e
  
          raise RuntimeError(
              f"Reservation for trial {trial.id} has been lost."
          ) 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 33 for calling the ExperimentClient obj's underlying member method code with example usage: obj.observe(trial, results, name) without return types