-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathconstants.py
More file actions
64 lines (55 loc) · 1.87 KB
/
constants.py
File metadata and controls
64 lines (55 loc) · 1.87 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
55
56
57
58
59
60
61
62
63
64
class Constants:
DEFAULT_MODEL_HOST_IP = ''
DEFAULT_MODEL_HOST_PORT = ''
DATABASE_URL = "DATABASE_URL"
DATABASE_PORT = "DATABASE_PORT"
DATABASE_NAME = "DATABASE_NAME"
DATABASE_REPLICA_SET = "DATABASE_REPLICA_SET"
MICROSERVICE_IP = "MICROSERVICE_IP"
MICROSERVICE_PORT = "MICROSERVICE_PORT"
MESSAGE_RESULT = "result"
DELETED_MESSAGE = "deleted observer"
HTTP_STATUS_CODE_SUCCESS_CREATED = 201
HTTP_STATUS_CODE_SUCCESS_FULFILLED = 200
HTTP_STATUS_CODE_BAD_REQUEST = 400
HTTP_STATUS_CODE_CONFLICT = 409
HTTP_STATUS_CODE_NOT_ACCEPTABLE = 406
HTTP_STATUS_CODE_TIMED_OUT = 408
REQUEST_JSON_OBSERVE_TYPE = 'observe_type'
REQUEST_JSON_TIMEOUT = 'timeout'
REQUEST_JSON_OBSERVER_NAME = 'observer_name'
REQUEST_JSON_FILENAME = 'filename'
REQUEST_JSON_CUSTOM_PIPELINE = 'pipeline'
MICROSERVICE_URI_PATH = "/api/learningOrchestra/v1/observer"
MONGO_WAIT_PIPELINE = \
{
'$match': {
'$and':
[
{'operationType': 'update'},
{'fullDocument.finished': {'$eq': True}}
]
}
}
MONGO_OBSERVE_PIPELINE = \
{
'$match': {
'$or': [
{'operationType': 'update'},
{'operationType': 'insert'},
{'operationType': 'replace'},
{'operationType': 'delete'}
]
}
}
MONGO_FIELDS_PIPELINE = \
{
'$addFields': {
'clusterTime': {'$dateToString': {'date': '$clusterTime',
'format': '%d/%m/%G'}}
}
}
DEFAULT_OBSERVER_NAME_PREFIX = 'observer_'
OBSERVER_TYPE_WAIT = 'wait'
OBSERVER_TYPE_OBSERVE = 'observe'
OBSERVER_TYPE_CUSTOM = 'custom'