code: def test_log_policy_exclude_slurm(should_match: bool) -> None:
      agents = bindings.get_GetAgents(
          api_utils.determined_test_session()
      ).agents
      if len(agents) != 1:
          pytest.skip("can only be run on a single agent cluster")
  
      regex = r"assert 0 <= self\.metrics_sigma"
      if not should_match:
          regex = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b"
  
      config = conf.load_config(
          conf.fixtures_path("no_op/single-medium-train-step.yaml")
      )
      config["log_policies"] = [
          {
              "pattern": regex,
              "action": {
                  "type": "exclude_node",
              },
          },
      ]
      config["hyperparameters"]["metrics_sigma"] = -1
      config["max_restarts"] = 1
  
      with tempfile.NamedTemporaryFile() as tf:
          with open(tf.name, "w") as f:
              yaml.dump(config, f)
          exp_id = exp.create_experiment(
              tf.name, conf.fixtures_path("no_op")
          )
      exp.wait_for_experiment_state(
          exp_id, bindings.experimentv1State.ERROR
      )
  
      trials = exp.experiment_trials(exp_id)
      assert len(trials) == 1
      assert trials[0].trial.restarts == 1
  
      times_ran = "\n".join(exp.trial_logs(trials[0].trial.id)).count(
          "Validating checkpoint storage"
      )
      if should_match:
          assert (
              times_ran == 1
          )  # Job fails to start up the second restart since all nodes are excluded.
      else:
          assert times_ran == 2
  
file_path: determined/e2e_tests/tests/cluster/test_log_policies.py
imports: import tempfile
  import pytest
  import yaml
  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 4 for calling a global function with example usage: test_log_policy_exclude_slurm(should_match) without return types