class_docstr: Simulator for a backend deployment with concurrent dispatch and a queue.
class_docstr_tok: ["Simulator","for","a","backend","deployment","with","concurrent","dispatch","and","a","queue","."]
docstr: Construct a simulator from a state.
  
  Args:
      state: A ``BackendSimulatorState`` to set the simulator to.
  
  Returns:
      A ``BackendSimulator`` with the desired state.
docstr_tok: ["Construct","a","simulator","from","a","state",".","Args",":","state",":","A","``","BackendSimulatorState","``","to","set","the","simulator","to",".","Returns",":","A","``","BackendSimulator","``","with","the","desired","state","."]
code: def from_state(cls, state: BackendSimulatorState):
      """Construct a simulator from a state.
  
      Args:
          state: A ``BackendSimulatorState`` to set the simulator to.
  
      Returns:
          A ``BackendSimulator`` with the desired state.
      """
      trial_types = {
          "queued": state.queued,
          "running": state.running,
          "failed": state.failed,
          "completed": state.completed,
      }
      trial_kwargs = {
          key: [
              SimTrial(**kwargs) for kwargs in trial_types[key]
          ]  # pyre-ignore [6]
          for key in ("queued", "running", "failed", "completed")
      }
      return cls(
          options=state.options,
          verbose_logging=state.verbose_logging,
          **trial_kwargs,
      )
  
imports: import logging
  import random
  import time
  from dataclasses import dataclass
  from logging import Logger
  from typing import Dict, List, Optional
  from ax.core.base_trial import TrialStatus
  from ax.utils.common.logger import get_logger
label_desc: Use image node_id 12 for calling the BackendSimulator obj's underlying member method code with example usage: obj.from_state(cls, state) and returns: cls