Coverage for src / lexigram / contracts / infra / tasks / enums.py: 0%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-19 05:41 +0800

1"""Task and job queue enums for Lexigram Framework.""" 

2 

3from __future__ import annotations 

4 

5from enum import StrEnum 

6 

7 

8class JobStatus(StrEnum): 

9 """JobProtocol execution status.""" 

10 

11 PENDING = "pending" 

12 RUNNING = "running" 

13 COMPLETED = "completed" 

14 FAILED = "failed" 

15 RETRYING = "retrying" 

16 CANCELLED = "cancelled" 

17 

18 

19class OnErrorPolicy(StrEnum): 

20 """Controls what happens when a scheduled worker cycle raises. 

21 

22 Attributes: 

23 LOG_AND_CONTINUE: Log the error, then resume the normal schedule. 

24 BACKOFF: Log the error and double the sleep before the next cycle 

25 (up to ``10 * interval_seconds``). 

26 STOP: Log the error and stop the worker permanently. 

27 """ 

28 

29 LOG_AND_CONTINUE = "LOG_AND_CONTINUE" 

30 BACKOFF = "BACKOFF" 

31 STOP = "STOP" 

32 

33 

34__all__ = ["JobStatus", "OnErrorPolicy"]