class_docstr: Yield a singe search op.  We need a way for this to be configurable.
class_docstr_tok: ["Yield","a","singe","search","op",".","We","need","a","way","for","this","to","be","configurable","."]
code: def operations(
      self,
      searcher_mode: SearcherMode = SearcherMode.WorkersAskChief,
      auto_ack: bool = True,
  ) -> Iterator[SearcherOperation]:
      searcher_mode = SearcherMode(searcher_mode)
      # Force the same synchronization behavior in the DummySearcherContext as the real one.
      if self._dist.rank == 0:
          # Chief makes a dummy op.
          op = DummySearcherOperation(
              self._length, self._dist.rank == 0
          )
          if searcher_mode == SearcherMode.WorkersAskChief:
              # Broadcast op to workers.
              _ = self._dist.broadcast(op and op.length)
          yield op
          if not op._completed:
              raise RuntimeError(
                  "you must call op.report_completed() on each operation"
              )
          if searcher_mode == SearcherMode.WorkersAskChief:
              _ = self._dist.broadcast(None)
      else:
          if searcher_mode != SearcherMode.WorkersAskChief:
              raise RuntimeError(
                  "you cannot call searcher.operations(searcher_mode=ChiefOnly) "
                  "from a non-chief worker."
              )
          # Worker gets operations from chief.
          while True:
              op_length = self._dist.broadcast(None)
              if op_length is None:
                  break
              yield DummySearcherOperation(op_length, False)
  
imports: import enum
  import logging
  from typing import Any, Iterator, Optional
  import determined
  from determined import core
  from determined.common import api
label_desc: Use image node_id 2 for calling the DummySearcherContext obj's underlying member method code with example usage: obj.operations(searcher_mode, auto_ack) without return types