class_docstr: ``SearcherContext`` gives direct access to operations emitted by the search algorithm in the
  master.  Each ``SearcherOperation`` emitted has a (unitless) length that you should train for,
  then you complete the op by reporting the validation metric you are searching over.
  
  It is the user's responsibility to execute the required training.  Because the user configured
  the length of the searcher in the experiment configuration, the user should know if the unitless
  length represents epochs, batches, records, etc.
  
  It is also the user's responsibility to evaluate the model after training and report the correct
  metric; if you intend to search over a metric called val_accuracy, you should report
  val_accuracy.
  
  Lastly, it is recommended (not required) to report progress periodically, so that the webui can
  accurately reflect current progress.  Progress is another unitless length.
  
  Example:
  
  .. code:: python
  
     # Assuming you configured the searcher in terms of batches,
     # the op.length is also interpeted as a batch count.
     # Note that you'll have to load your starting point from a
     # checkpoint if you want to support pausing/continuing training.
     batches_trained = 0
  
     for op in core_context.searcher.operations():
         # Train for however long the op requires you to.
         # Note that op.length is an absolute length, not an
         # incremental length:
         while batches_trained < op.length:
             my_train_batch()
  
             batches_trained += 1
  
             # Reporting progress every batch would be expensive:
             if batches_trained % 1000:
                 op.report_progress(batches_trained)
  
         # After training the required amount, pass your searcher
         # metric to op.report_completed():
         val_metrics = my_validate()
         op.report_completed(val_metrics["my_searcher_metric"])
  
  Note that reporting metrics is completely independent of the SearcherContext API, using
  ``core_context.train.report_training_metrics()`` or
  ``core_context.train.report_validation_metrics()``.
class_docstr_tok: ["``","SearcherContext","``","gives","direct","access","to","operations","emitted","by","the","search","algorithm","in","the","master",".","Each","``","SearcherOperation","``","emitted","has","a","(","unitless",")","length","that","you","should","train","for",",","then","you","complete","the","op","by","reporting","the","validation","metric","you","are","searching","over",".","It","is","the","user","'s","responsibility","to","execute","the","required","training",".","Because","the","user","configured","the","length","of","the","searcher","in","the","experiment","configuration",",","the","user","should","know","if","the","unitless","length","represents","epochs",",","batches",",","records",",","etc",".","It","is","also","the","user","'s","responsibility","to","evaluate","the","model","after","training","and","report","the","correct","metric",";","if","you","intend","to","search","over","a","metric","called","val_accuracy",",","you","should","report","val_accuracy",".","Lastly",",","it","is","recommended","(","not","required",")","to","report","progress","periodically",",","so","that","the","webui","can","accurately","reflect","current","progress",".","Progress","is","another","unitless","length",".","Example",":","..","code",":",":","python","#","Assuming","you","configured","the","searcher","in","terms","of","batches",",","#","the","op.length","is","also","interpeted","as","a","batch","count",".","#","Note","that","you","'ll","have","to","load","your","starting","point","from","a","#","checkpoint","if","you","want","to","support","pausing\/continuing","training",".","batches_trained","=","0","for","op","in","core_context.searcher.operations","(",")",":","#","Train","for","however","long","the","op","requires","you","to",".","#","Note","that","op.length","is","an","absolute","length",",","not","an","#","incremental","length",":","while","batches_trained","<","op.length",":","my_train_batch","(",")","batches_trained","+=","1","#","Reporting","progress","every","batch","would","be","expensive",":","if","batches_trained","%","1000",":","op.report_progress","(","batches_trained",")","#","After","training","the","required","amount",",","pass","your","searcher","#","metric","to","op.report_completed","(",")",":","val_metrics","=","my_validate","(",")","op.report_completed","(","val_metrics","[","``","my_searcher_metric","''","]",")","Note","that","reporting","metrics","is","completely","independent","of","the","SearcherContext","API",",","using","``","core_context.train.report_training_metrics","(",")","``","or","``","core_context.train.report_validation_metrics","(",")","``","."]
code: def __init__(
      self,
      session: api.Session,
      dist: core.DistributedContext,
      trial_id: int,
      run_id: int,
      allocation_id: str,
      units: Optional[Unit] = None,
  ) -> None:
      self._session = session
      self._dist = dist
      self._trial_id = trial_id
      self._run_id = run_id
      self._allocation_id = allocation_id
      self._units = units
  
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 1 to create a new SearcherContext object  with example: obj = SearcherContext(session, dist, trial_id, run_id, allocation_id, units)