error.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from ray.util.annotations import PublicAPI
  2. @PublicAPI
  3. class TuneError(Exception):
  4. """General error class raised by ray.tune."""
  5. pass
  6. class _AbortTrialExecution(TuneError):
  7. """Error that indicates a trial should not be retried."""
  8. pass
  9. class _SubCategoryTuneError(TuneError):
  10. """The more specific TuneError that happens for a certain Tune
  11. subroutine. For example starting/stopping a trial.
  12. """
  13. def __init__(self, traceback_str: str):
  14. self.traceback_str = traceback_str
  15. def __str__(self):
  16. return self.traceback_str
  17. class _TuneStopTrialError(_SubCategoryTuneError):
  18. """Error that happens when stopping a tune trial."""
  19. pass
  20. class _TuneStartTrialError(_SubCategoryTuneError):
  21. """Error that happens when starting a tune trial."""
  22. pass
  23. class _TuneNoNextExecutorEventError(_SubCategoryTuneError):
  24. """Error that happens when waiting to get the next event to
  25. handle from RayTrialExecutor.
  26. Note: RayTaskError will be raised by itself and will not be using
  27. this category. This category is for everything else."""
  28. pass