code: def test_searcher_chief_only(dummy: bool) -> None:
      with parallel.Execution(2) as pex:
  
          @pex.run
          def do_test() -> None:
              if not dummy:
                  searcher = make_test_searcher(
                      [5, 10, 15], pex.distributed
                  )
              else:
                  searcher = core.DummySearcherContext(
                      dist=pex.distributed
                  )
  
              with parallel.raises_when(
                  pex.rank != 0,
                  RuntimeError,
                  match="searcher.operations.*chief",
              ):
                  next(
                      iter(
                          searcher.operations(
                              core.SearcherMode.ChiefOnly
                          )
                      )
                  )
  
file_path: determined/harness/tests/core/test_searcher.py
imports: from typing import Any, List
  from unittest import mock
  import pytest
  from determined import core
  from tests import parallel
label_desc: Use image node_id 4 for calling a global function with example usage: test_searcher_chief_only(dummy) without return types