class_docstr: Experiment node to connect experiments to EVC tree.
  
  The node carries an experiment in attribute `item`. The node can be instantiated only using the
  name of the experiment. The experiment will be created lazily on access to `node.item`.
  
  Attributes
  ----------
  name: str
      Name of the experiment
  item: None or :class:`orion.core.worker.experiment.Experiment`
      None if the experiment is not initialized yet. When initializing lazily, it creates an
      `Experiment` in read only mode.
  
  .. seealso::
  
      :py:class:`orion.core.utils.tree.TreeNode` for tree-specific attributes and methods.
class_docstr_tok: ["Experiment","node","to","connect","experiments","to","EVC","tree",".","The","node","carries","an","experiment","in","attribute","`","item","`",".","The","node","can","be","instantiated","only","using","the","name","of","the","experiment",".","The","experiment","will","be","created","lazily","on","access","to","`","node.item","`",".","Attributes","--","--","--","--","--","name",":","str","Name","of","the","experiment","item",":","None","or",":","class",":","`","orion.core.worker.experiment.Experiment","`","None","if","the","experiment","is","not","initialized","yet",".","When","initializing","lazily",",","it","creates","an","`","Experiment","`","in","read","only","mode",".","..","seealso",":",":",":","py",":","class",":","`","orion.core.utils.tree.TreeNode","`","for","tree-specific","attributes","and","methods","."]
docstr: Fetch trials recursively in the EVC tree using the fetch function `fun_name`.
  
  Parameters
  ----------
  fun_name: callable
      Function name to call to fetch trials. The function must be an attribute of
      :class:`orion.core.worker.experiment.Experiment`
  
  *args:
      Positional arguments to pass to `fun_name`.
  
  **kwargs
      Keyword arguments to pass to `fun_name`.
docstr_tok: ["Fetch","trials","recursively","in","the","EVC","tree","using","the","fetch","function","`","fun_name","`",".","Parameters","--","--","--","--","--","fun_name",":","callable","Function","name","to","call","to","fetch","trials",".","The","function","must","be","an","attribute","of",":","class",":","`","orion.core.worker.experiment.Experiment","`","*","args",":","Positional","arguments","to","pass","to","`","fun_name","`",".","*","*","kwargs","Keyword","arguments","to","pass","to","`","fun_name","`","."]
code: def recurvise_fetch(self, fun_name, *args, **kwargs):
      """Fetch trials recursively in the EVC tree using the fetch function `fun_name`.
  
      Parameters
      ----------
      fun_name: callable
          Function name to call to fetch trials. The function must be an attribute of
          :class:`orion.core.worker.experiment.Experiment`
  
      *args:
          Positional arguments to pass to `fun_name`.
  
      **kwargs
          Keyword arguments to pass to `fun_name`.
  
      """
  
      def retrieve_trials(node, parent_or_children):
          """Retrieve the trials of a node/experiment."""
          fun = getattr(node.item, fun_name)
          # with_evc_tree needs to be False here or we will have an infinite loop
          trials = fun(*args, with_evc_tree=False, **kwargs)
          return (
              dict(trials=trials, experiment=node.item),
              parent_or_children,
          )
  
      # get the trials of the parents
      parent_trials = None
      if self.parent is not None:
          parent_trials = self.parent.map(
              retrieve_trials, self.parent.parent
          )
  
      # get the trials of the children
      children_trials = self.map(retrieve_trials, self.children)
      children_trials.set_parent(parent_trials)
  
      adapt_trials(children_trials)
  
      return sum(
          (node.item["trials"] for node in children_trials.root), []
      )
  
file_path: orion/src/orion/core/evc/experiment.py
imports: import functools
  import logging
  from orion.core.utils.tree import TreeNode
label_desc: Use image node_id 12 for calling the ExperimentNode obj's underlying member method code with example usage: obj.recurvise_fetch(fun_name) and returns: sum, dict,  parent_or_children