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: Stop a simulated trial by setting the completed time to the current time.
  
  Args:
      trial_index: The index of the trial to stop.
docstr_tok: ["Stop","a","simulated","trial","by","setting","the","completed","time","to","the","current","time",".","Args",":","trial_index",":","The","index","of","the","trial","to","stop","."]
code: def stop_trial(self, trial_index: int) -> None:
      """Stop a simulated trial by setting the completed time to the current time.
  
      Args:
          trial_index: The index of the trial to stop.
      """
      trial_status = self.lookup_trial_index_status(trial_index)
      if trial_status is not TrialStatus.RUNNING:
          logger.info(
              f"Trial {trial_index} is not currently running (has status "
              f"{trial_status}) and cannot be stopped."
          )
      else:
          trial = self._index_to_trial_map[trial_index]
          trial.sim_completed_time = self.time
          logger.info(
              f"Trial {trial_index} stopped at time {trial.sim_completed_time}."
          )
  
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 15 for calling the BackendSimulator obj's underlying member method code with example usage: obj.stop_trial(trial_index) without return types