class_docstr: ``TrainContext`` gives access to report training and validation metrics to the Determined master
  during trial tasks.
class_docstr_tok: ["``","TrainContext","``","gives","access","to","report","training","and","validation","metrics","to","the","Determined","master","during","trial","tasks","."]
docstr: Report an early exit reason to the Determined master.
  
  Currenlty, the only meaningful value to report is ``EarlyExitReason.INVALID_HP``, which is
  reported automatically in ``core.Context.__exit__()`` detects an exception of type
  ``det.InvalidHP``.
docstr_tok: ["Report","an","early","exit","reason","to","the","Determined","master",".","Currenlty",",","the","only","meaningful","value","to","report","is","``","EarlyExitReason.INVALID_HP","``",",","which","is","reported","automatically","in","``","core.Context.__exit__","(",")","``","detects","an","exception","of","type","``","det.InvalidHP","``","."]
code: def report_early_exit(self, reason: EarlyExitReason) -> None:
      """
      Report an early exit reason to the Determined master.
  
      Currenlty, the only meaningful value to report is ``EarlyExitReason.INVALID_HP``, which is
      reported automatically in ``core.Context.__exit__()`` detects an exception of type
      ``det.InvalidHP``.
      """
  
      body = {"reason": EarlyExitReason(reason).value}
      logger.info(f"report_early_exit({reason})")
      r = self._session.post(
          f"/api/v1/trials/{self._trial_id}/early_exit",
          data=det.util.json_encode(body),
      )
      if r.status_code == 400:
          logger.warn(
              "early exit has already been reported for this trial, ignoring new value"
          )
  
imports: import enum
  import logging
  import pathlib
  from typing import Any, Callable, Dict, List, Optional, Set
  import determined
  from determined import core, tensorboard
  from determined.common import api, util
  from determined.common.api import bindings, errors
label_desc: Use image node_id 11 for calling the TrainContext obj's underlying member method code with example usage: obj.report_early_exit(reason) without return types