code: def test_continue_max_restart() -> None:
      exp_id = exp.create_experiment(
          conf.fixtures_path("no_op/single-medium-train-step.yaml"),
          conf.fixtures_path("no_op"),
          [
              "--config",
              "hyperparameters.metrics_sigma=-1.0",
              "--config",
              "max_restarts=2",
          ],
      )
      exp.wait_for_experiment_state(
          exp_id, bindings.experimentv1State.ERROR
      )
  
      trials = exp.experiment_trials(exp_id)
      assert len(trials) == 1
  
      def count_times_ran() -> int:
          return "\n".join(exp.trial_logs(trials[0].trial.id)).count(
              "assert 0 <= self.metrics_sigma"
          )
  
      def get_trial_restarts() -> int:
          experiment_trials = exp.experiment_trials(exp_id)
          assert len(experiment_trials) == 1
          return experiment_trials[0].trial.restarts
  
      assert count_times_ran() == 3
      assert get_trial_restarts() == 2
  
      det_cmd(["e", "continue", str(exp_id)], check=True)
      exp.wait_for_experiment_state(
          exp_id, bindings.experimentv1State.ERROR
      )
      assert count_times_ran() == 6
      assert get_trial_restarts() == 2
  
      det_cmd(
          ["e", "continue", str(exp_id), "--config", "max_restarts=1"],
          check=True,
      )
      exp.wait_for_experiment_state(
          exp_id, bindings.experimentv1State.ERROR
      )
      assert count_times_ran() == 8
      assert get_trial_restarts() == 1
  
file_path: determined/e2e_tests/tests/cluster/test_exp_continue.py
imports: import subprocess
  import tempfile
  from typing import Any, List, Tuple
  import pytest
  from determined.common import util
  from determined.common.api import bindings
  from tests import api_utils
  from tests import config
  from tests import experiment
label_desc: Use image node_id 5 for calling a global function with example usage: test_continue_max_restart() and returns: str, experiment_trials