code: def test_retry_invalid_trial(tmp_path):
      oracle = OracleStub(
          directory=tmp_path,
          objective="val_loss",
          max_retries_per_trial=1,
      )
      trial_1 = oracle.create_trial(tuner_id="a")
      trial_1.status = trial_module.TrialStatus.INVALID
      trial_1.message = "error1"
      oracle.end_trial(trial_1)
  
      # This is the retry for the trial.
      trial_2 = oracle.create_trial(tuner_id="a")
      assert trial_1.trial_id == trial_2.trial_id
  
      # Retried once. This is a new trial.
      trial_3 = oracle.create_trial(tuner_id="b")
      assert trial_1.trial_id != trial_3.trial_id
  
imports: import datetime
  import threading
  import time
  import numpy
  import pytest
  import keras_tuner
  from keras_tuner.engine import oracle
  from keras_tuner.engine import trial
  from keras_tuner.tuners import gridsearch
label_desc: Use image node_id 13 for calling a global function with example usage: test_retry_invalid_trial(tmp_path) without return types