code: def test_master_restart_with_queued(
      k8s_managed_cluster: ManagedK8sCluster,
  ) -> None:
      agent_data = get_agent_data(conf.make_master_url())
      slots = sum([a["num_slots"] for a in agent_data])
  
      running_command_id = run_command(120, slots)
      wait_for_command_state(running_command_id, "RUNNING", 30)
  
      queued_command_id = run_command(60, slots)
      wait_for_command_state(queued_command_id, "QUEUED", 30)
  
      job_list = det_cmd_json(["job", "list", "--json"])["jobs"]
  
      k8s_managed_cluster.kill_master()
      k8s_managed_cluster.restart_master()
  
      post_restart_job_list = det_cmd_json(["job", "list", "--json"])[
          "jobs"
      ]
  
      assert job_list == post_restart_job_list
  
      for cmd_id in [running_command_id, queued_command_id]:
          wait_for_command_state(cmd_id, "TERMINATED", 90)
          assert_command_succeeded(cmd_id)
  
imports: import logging
  import subprocess
  import time
  import docker
  import pytest
  import requests
  from determined.common import constants
  from determined.common.api import authentication, task_is_ready, task_logs
  from determined.common.api.bindings import experimentv1State
  from tests import api_utils
  from tests import command
  from tests import config
  from tests import experiment
  from tests.cluster.test_users import det_spawn
  from .abstract_cluster import Cluster
  from .managed_cluster import ManagedCluster, get_agent_data
  from .managed_cluster_k8s import ManagedK8sCluster
  from .test_groups import det_cmd, det_cmd_json
  from .utils import assert_command_succeeded, run_command, wait_for_command_state, wait_for_task_state
label_desc: Use image node_id 29 for calling a global function with example usage: test_master_restart_with_queued(k8s_managed_cluster) without return types