-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconstants.py
58 lines (44 loc) · 1.82 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from enum import Enum
class Priority(Enum):
"""
Class designed for having a set of priorities
If a resource is requested to lock from the UI, it means
that it is ready to be locked immediately.
But if a resource is requested to retrieve from search_string,
then it should include the priority level from 1 to any integer you decide
For Example, a group could decide to priority their queues that are pending for a request
in the following way:
UI - 0
PRODUCTION TESTING - 1
LOAD TESTING - 2
DEVELOPMENT TESTING - 3
"""
UI = 0
class Interval:
RESOURCE_FREE_WAIT = 10
QUEUE_TURN_WAIT = 30
REQUEST_TIMEOUT = 600
class Status:
PENDING = (
"PENDING" # describes that it still waits to be assigned to a lockable resource
)
ALMOST_FINISHED = (
"ALMOST_FINISHED" # describes that it is close to lock the desired resource
)
FINISHED = "FINISHED" # describes that it locked a lockable resource successfully
FAILED = "FAILED" # describes that it attempted to lock a resource but failed
ABORTED = "ABORTED" # describes a failure to lock a resource because of manual interruption
INITIALIZING = "INITIALIZING" # describes a situation that the queue is not handled yet by any svc
# We also need to customize all the options in a way that is supportive in Django dropdown field:
# TODO: Create a generic list of tuples depending on the values above!
CHOICES = [
(PENDING, "PENDING"),
(ALMOST_FINISHED, "ALMOST_FINISHED"),
(FINISHED, "FINISHED"),
(FAILED, "FAILED"),
(ABORTED, "ABORTED"),
(INITIALIZING, "INITIALIZING"),
]
PRESENT_STATUS_OPTIONS = [PENDING, INITIALIZING, ALMOST_FINISHED]
PAST_STATUS_OPTIONS = [FAILED, ABORTED, FINISHED]
DISPLAY_COUNT_PER_PAGE = 25