class_docstr: Record of the Experiment completion event. This can be used for telemetry in
  settings where many Experiments are being created either manually or
  programatically. In order to facilitate easy serialization only include simple
  types: numbers, strings, bools, and None.
code: def from_experiment(
      cls, experiment: Experiment
  ) -> ExperimentCompletedRecord:
      trial_count_by_status = {
          status: len(trials)
          for status, trials in experiment.trials_by_status.items()
      }
  
      model_keys = [
          trial.generator_runs[0]._model_key
          for trial in experiment.trials.values()
      ]
  
      fit_time, gen_time = get_model_times(experiment=experiment)
  
      return cls(
          num_initialization_trials=sum(
              1
              for model_key in model_keys
              if model_key in INITIALIZATION_MODEL_STRS
          ),
          num_bayesopt_trials=sum(
              1
              for model_key in model_keys
              if not (
                  model_key in INITIALIZATION_MODEL_STRS
                  or model_key in OTHER_MODEL_STRS
              )
          ),
          num_other_trials=sum(
              1
              for model_key in model_keys
              if model_key in OTHER_MODEL_STRS
          ),
          num_completed_trials=trial_count_by_status[
              TrialStatus.COMPLETED
          ],
          num_failed_trials=trial_count_by_status[TrialStatus.FAILED],
          num_abandoned_trials=trial_count_by_status[
              TrialStatus.ABANDONED
          ],
          num_early_stopped_trials=trial_count_by_status[
              TrialStatus.EARLY_STOPPED
          ],
          total_fit_time=int(fit_time),
          total_gen_time=int(gen_time),
      )
  
file_path: Ax/ax/telemetry/experiment.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from math import inf
  from typing import Dict, List, Optional, Tuple
  from ax.core.base_trial import TrialStatus
  from ax.core.experiment import Experiment
  from ax.core.map_metric import MapMetric
  from ax.core.parameter import ChoiceParameter, FixedParameter, ParameterType, RangeParameter
  from ax.core.search_space import HierarchicalSearchSpace, SearchSpace
  from ax.core.utils import get_model_times
  from ax.telemetry.common import INITIALIZATION_MODELS, OTHER_MODELS
label_desc: Use image node_id 1 for calling the ExperimentCompletedRecord obj's underlying member method code with example usage: obj.from_experiment(cls, experiment) and returns: cls