-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (41 loc) · 1.51 KB
/
main.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
"""
This is the main file that runs the OpenEEW code package
"""
from threading import Thread
from params import params
from src import receive_topic, data_holders, ibm_topic
def main():
"""Does everything"""
# Create a Detections DataFrame.
detections = data_holders.Detections()
# Create a Events DataFrame.
events = data_holders.Events()
# We create and start receive detection worker
detection_rec = receive_topic.ReceiveTopic(
topic_list=detections, topic="detection", params=params
)
det_rec_process = Thread(target=detection_rec.run)
det_rec_process.start()
# We create and start receive event worker
event_rec = receive_topic.ReceiveTopic(
topic_list=events, topic="event", params=params
)
ev_rec_process = Thread(target=event_rec.run)
ev_rec_process.start()
# We create and start publish detection worker
detection_send = ibm_topic.Topic2IBM(
topic_list=detections, topic="detection", params=params
)
det_send_process = Thread(target=detection_send.run)
det_send_process.start()
# We create and start publish event worker
event_send = ibm_topic.Topic2IBM(topic_list=events, topic="event", params=params)
ev_send_process = Thread(target=event_send.run)
ev_send_process.start()
# We join our Threads, i.e. we wait for them to finish before continuing
det_rec_process.join()
ev_rec_process.join()
det_send_process.join()
ev_send_process.join()
if __name__ == "__main__":
main()