-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathimpressions.py
More file actions
54 lines (43 loc) · 1.27 KB
/
impressions.py
File metadata and controls
54 lines (43 loc) · 1.27 KB
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
"""Impressions model module."""
from collections import namedtuple
Impression = namedtuple(
'Impression',
[
'matching_key',
'feature_name',
'treatment',
'label',
'change_number',
'bucketing_key',
'time',
'previous_time'
]
)
# pre-python3.7 hack to make previous_time optional
Impression.__new__.__defaults__ = (None,)
class Label(object): # pylint: disable=too-few-public-methods
"""Impressions labels."""
# Condition: Split Was Killed
# Treatment: Default treatment
# Label: killed
KILLED = 'killed'
# Condition: No condition matched
# Treatment: Default Treatment
# Label: no condition matched
NO_CONDITION_MATCHED = 'default rule'
# Condition: Split definition was not found
# Treatment: control
# Label: split not found
SPLIT_NOT_FOUND = 'definition not found'
# Condition: Traffic allocation failed
# Treatment: Default Treatment
# Label: not in split
NOT_IN_SPLIT = 'not in split'
# Condition: There was an exception
# Treatment: control
# Label: exception
EXCEPTION = 'exception'
# Condition: Evaluation requested while client not ready
# Treatment: control
# Label: not ready
NOT_READY = 'not ready'