code: def restartable_managed_slurm_cluster(
      managed_slurm_cluster_restarts: ManagedSlurmCluster,
  ) -> Iterator[ManagedSlurmCluster]:
      try:
          yield managed_slurm_cluster_restarts
      except Exception:
          managed_slurm_cluster_restarts.restart_master()
          raise
  
file_path: determined/e2e_tests/tests/cluster/test_master_restart_slurm.py
imports: import logging
  from typing import Iterator
  import pytest
  from .managed_slurm_cluster import ManagedSlurmCluster
  from .test_master_restart import _test_master_restart_cmd, _test_master_restart_ok, _test_master_restart_reattach_recover_experiment
label_desc: Use image node_id 1 for calling a global function with example usage: restartable_managed_slurm_cluster(managed_slurm_cluster_restarts) without return types