constants.py 887 B

12345678910111213141516171819202122232425262728293031323334
  1. from dataclasses import dataclass
  2. from django.utils.translation import gettext_lazy as _
  3. from rq.job import JobStatus
  4. __all__ = (
  5. 'JOB_LOG_ENTRY_LEVELS',
  6. 'RQ_TASK_STATUSES',
  7. )
  8. @dataclass
  9. class Badge:
  10. label: str
  11. color: str
  12. RQ_TASK_STATUSES = {
  13. JobStatus.QUEUED: Badge(_('Queued'), 'cyan'),
  14. JobStatus.FINISHED: Badge(_('Finished'), 'green'),
  15. JobStatus.FAILED: Badge(_('Failed'), 'red'),
  16. JobStatus.STARTED: Badge(_('Started'), 'blue'),
  17. JobStatus.DEFERRED: Badge(_('Deferred'), 'gray'),
  18. JobStatus.SCHEDULED: Badge(_('Scheduled'), 'purple'),
  19. JobStatus.STOPPED: Badge(_('Stopped'), 'orange'),
  20. JobStatus.CANCELED: Badge(_('Cancelled'), 'yellow'),
  21. }
  22. JOB_LOG_ENTRY_LEVELS = {
  23. 'debug': Badge(_('Debug'), 'gray'),
  24. 'info': Badge(_('Info'), 'blue'),
  25. 'warning': Badge(_('Warning'), 'orange'),
  26. 'error': Badge(_('Error'), 'red'),
  27. }