-
Notifications
You must be signed in to change notification settings - Fork 39
/
base_engine.py
48 lines (37 loc) · 1.09 KB
/
base_engine.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
"""
This is the mother class for engine executing executing questions in EleData.
@params:
- group:
Model Object of user group, corresponding for retrieving the entity data and the destination for the output(event).
And all executing engine should experience the same life-cycle:
Initializing Engine
- engine.init()
"""
from multiprocessing import Process
from abc import abstractmethod
class BaseEngine(object):
group = None
response = None
params = None
def __init__(self, event_id, group, params):
self.event_id = event_id
self.group = group
self.params = params
@abstractmethod
def execute(self):
"""
void function to update intermediate/ ultimate response
"""
@abstractmethod
def event_init(self):
"""
(When engine is for Event Response)
void function to update
"""
def get_processed(self):
"""
(When engine is not for Event Response)
Return engine response in series way
:return: engine ultimate response
"""
return self.response