code: def managed_slurm_cluster_restarts(
      managed_slurm_cluster_session: ManagedSlurmCluster, request: Any
  ) -> Iterator[ManagedSlurmCluster]:
      if os.getenv("IS_CIRCLECI_JOB"):
          # CircleCI job has master running on port 8080
          conf.MASTER_PORT = "8080"
      else:
          # Local instance of devcluster is run on port 8081
          conf.MASTER_PORT = "8081"
      nodeid = request.node.nodeid
      managed_slurm_cluster_session.log_marker(
          f"pytest [{now_ts()}] {nodeid} setup\n"
      )
      yield managed_slurm_cluster_session
      managed_slurm_cluster_session.log_marker(
          f"pytest [{now_ts()}] {nodeid} teardown\n"
      )
  
imports: import os
  import subprocess
  import time
  from shlex import split
  from typing import Any, Iterator
  import pytest
  from tests import config
  from .abstract_cluster import Cluster
  from .utils import now_ts
label_desc: Use image node_id 2 for calling a global function with example usage: managed_slurm_cluster_restarts(managed_slurm_cluster_session, request) without return types