class_docstr: A global system that helps to manage the experiments.
class_docstr_tok: ["A","global","system","that","helps","to","manage","the","experiments","."]
docstr: Method for retrieving an experiment with given id or name. Once the `create` argument is set to
  True, if no valid experiment is found, this method will create one for you. Otherwise, it will
  only retrieve a specific experiment or raise an Error.
  
  - If '`create`' is True:
  
      - If `active experiment` exists:
  
          - no id or name specified, return the active experiment.
  
          - if id or name is specified, return the specified experiment. If no such exp found, create a new experiment with given id or name.
  
      - If `active experiment` not exists:
  
          - no id or name specified, create a default experiment, and the experiment is set to be active.
  
          - if id or name is specified, return the specified experiment. If no such exp found, create a new experiment with given name or the default experiment.
  
  - Else If '`create`' is False:
  
      - If `active experiment` exists:
  
          - no id or name specified, return the active experiment.
  
          - if id or name is specified, return the specified experiment. If no such exp found, raise Error.
  
      - If `active experiment` not exists:
  
          - no id or name specified. If the default experiment exists, return it, otherwise, raise Error.
  
          - if id or name is specified, return the specified experiment. If no such exp found, raise Error.
  
  Here are some use cases:
  
  .. code-block:: Python
  
      # Case 1
      with R.start('test'):
          exp = R.get_exp()
          recorders = exp.list_recorders()
  
      # Case 2
      with R.start('test'):
          exp = R.get_exp(experiment_name='test1')
  
      # Case 3
      exp = R.get_exp() -> a default experiment.
  
      # Case 4
      exp = R.get_exp(experiment_name='test')
  
      # Case 5
      exp = R.get_exp(create=False) -> the default experiment if exists.
  
  Parameters
  ----------
  experiment_id : str
      id of the experiment.
  experiment_name : str
      name of the experiment.
  create : boolean
      an argument determines whether the method will automatically create a new experiment
      according to user's specification if the experiment hasn't been created before.
  start : bool
      when start is True,
      if the experiment has not started(not activated), it will start
      It is designed for R.log_params to auto start experiments
  
  Returns
  -------
  An experiment instance with given id or name.
docstr_tok: ["Method","for","retrieving","an","experiment","with","given","id","or","name",".","Once","the","`","create","`","argument","is","set","to","True",",","if","no","valid","experiment","is","found",",","this","method","will","create","one","for","you",".","Otherwise",",","it","will","only","retrieve","a","specific","experiment","or","raise","an","Error",".","-","If","'","`","create","`","'","is","True",":","-","If","`","active","experiment","`","exists",":","-","no","id","or","name","specified",",","return","the","active","experiment",".","-","if","id","or","name","is","specified",",","return","the","specified","experiment",".","If","no","such","exp","found",",","create","a","new","experiment","with","given","id","or","name",".","-","If","`","active","experiment","`","not","exists",":","-","no","id","or","name","specified",",","create","a","default","experiment",",","and","the","experiment","is","set","to","be","active",".","-","if","id","or","name","is","specified",",","return","the","specified","experiment",".","If","no","such","exp","found",",","create","a","new","experiment","with","given","name","or","the","default","experiment",".","-","Else","If","'","`","create","`","'","is","False",":","-","If","`","active","experiment","`","exists",":","-","no","id","or","name","specified",",","return","the","active","experiment",".","-","if","id","or","name","is","specified",",","return","the","specified","experiment",".","If","no","such","exp","found",",","raise","Error",".","-","If","`","active","experiment","`","not","exists",":","-","no","id","or","name","specified",".","If","the","default","experiment","exists",",","return","it",",","otherwise",",","raise","Error",".","-","if","id","or","name","is","specified",",","return","the","specified","experiment",".","If","no","such","exp","found",",","raise","Error",".","Here","are","some","use","cases",":","..","code-block",":",":","Python","#","Case","1","with","R.start","(","'test","'",")",":","exp","=","R.get_exp","(",")","recorders","=","exp.list_recorders","(",")","#","Case","2","with","R.start","(","'test","'",")",":","exp","=","R.get_exp","(","experiment_name='test1","'",")","#","Case","3","exp","=","R.get_exp","(",")","-",">","a","default","experiment",".","#","Case","4","exp","=","R.get_exp","(","experiment_name='test","'",")","#","Case","5","exp","=","R.get_exp","(","create=False",")","-",">","the","default","experiment","if","exists",".","Parameters","--","--","--","--","--","experiment_id",":","str","id","of","the","experiment",".","experiment_name",":","str","name","of","the","experiment",".","create",":","boolean","an","argument","determines","whether","the","method","will","automatically","create","a","new","experiment","according","to","user","'s","specification","if","the","experiment","has","n't","been","created","before",".","start",":","bool","when","start","is","True",",","if","the","experiment","has","not","started","(","not","activated",")",",","it","will","start","It","is","designed","for","R.log_params","to","auto","start","experiments","Returns","--","--","--","-","An","experiment","instance","with","given","id","or","name","."]
code: def get_exp(
      self,
      *,
      experiment_id=None,
      experiment_name=None,
      create: bool = True,
      start: bool = False,
  ) -> Experiment:
      """
      Method for retrieving an experiment with given id or name. Once the `create` argument is set to
      True, if no valid experiment is found, this method will create one for you. Otherwise, it will
      only retrieve a specific experiment or raise an Error.
  
      - If '`create`' is True:
  
          - If `active experiment` exists:
  
              - no id or name specified, return the active experiment.
  
              - if id or name is specified, return the specified experiment. If no such exp found, create a new experiment with given id or name.
  
          - If `active experiment` not exists:
  
              - no id or name specified, create a default experiment, and the experiment is set to be active.
  
              - if id or name is specified, return the specified experiment. If no such exp found, create a new experiment with given name or the default experiment.
  
      - Else If '`create`' is False:
  
          - If `active experiment` exists:
  
              - no id or name specified, return the active experiment.
  
              - if id or name is specified, return the specified experiment. If no such exp found, raise Error.
  
          - If `active experiment` not exists:
  
              - no id or name specified. If the default experiment exists, return it, otherwise, raise Error.
  
              - if id or name is specified, return the specified experiment. If no such exp found, raise Error.
  
      Here are some use cases:
  
      .. code-block:: Python
  
          # Case 1
          with R.start('test'):
              exp = R.get_exp()
              recorders = exp.list_recorders()
  
          # Case 2
          with R.start('test'):
              exp = R.get_exp(experiment_name='test1')
  
          # Case 3
          exp = R.get_exp() -> a default experiment.
  
          # Case 4
          exp = R.get_exp(experiment_name='test')
  
          # Case 5
          exp = R.get_exp(create=False) -> the default experiment if exists.
  
      Parameters
      ----------
      experiment_id : str
          id of the experiment.
      experiment_name : str
          name of the experiment.
      create : boolean
          an argument determines whether the method will automatically create a new experiment
          according to user's specification if the experiment hasn't been created before.
      start : bool
          when start is True,
          if the experiment has not started(not activated), it will start
          It is designed for R.log_params to auto start experiments
  
      Returns
      -------
      An experiment instance with given id or name.
      """
      return self.exp_manager.get_exp(
          experiment_id=experiment_id,
          experiment_name=experiment_name,
          create=create,
          start=start,
      )
  
imports: from contextlib import contextmanager
  from typing import Text, Optional, Any, Dict
  from .expm import ExpManager
  from .exp import Experiment
  from .recorder import Recorder
  from ..utils import Wrapper
  from ..utils.exceptions import RecorderInitializationError
  import sys
label_desc: Use image node_id 9 for calling the QlibRecorder obj's underlying member method code with example usage: obj.get_exp() and returns: self