class_docstr: Inject failure at the configured iteration number.
class_docstr_tok: ["Inject","failure","at","the","configured","iteration","number","."]
code: def on_trial_result(
      self,
      iteration: int,
      trials: List[Trial],
      trial: Trial,
      result: Dict,
      **info,
  ):
      if not self.fail_marker_path.exists():
          return
  
      if (
          trial.last_result.get("training_iteration", -1)
          >= self.num_iters
      ):
          print(f"Failing after {self.num_iters} iters...")
          self.fail_marker_path.unlink()
          raise _TestSpecificError
  
imports: import warnings
  from pathlib import Path
  from typing import Dict, List
  import pytest
  import ray
  from ray import train
  from ray.air._internal.uri_utils import URI
  from ray.train import CheckpointConfig, RunConfig, ScalingConfig
  from ray.train.base_trainer import BaseTrainer
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train.lightgbm import LightGBMTrainer
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
  from ray.train.torch import TorchTrainer
  from ray.train.trainer import TrainingFailedError
  from ray.train.xgboost import XGBoostTrainer
  from ray.tune import Callback
  from ray.tune.experiment import Trial
label_desc: Use image node_id 2 for calling the FailureInjectionCallback obj's underlying member method code with example usage: obj.on_trial_result(iteration, trials, trial, result) without return types