-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_static_transformer.py
42 lines (32 loc) · 1.31 KB
/
run_static_transformer.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
"""
Created on Thu Jun 23, 2022
@author: teohz
"""
# from i24_database_api.DBReader import DBReader
from multiprocessing import Process, Queue, Value, Manager
import transformation
import change_stream_reader
import batch_update
from ctypes import c_char_p
if __name__=="__main__":
# (Optional) Uncomment the following two lines if config.json cannot be loaded
# path_to_directory = "/isis/home/teohz/Desktop/i24-transform-module"
# os.chdir(path_to_directory)
# Mode for the transformation module, automatically determined
# ... initialize as None
manager=Manager()
mode = manager.Value(c_char_p,"")
# mode = None
# initialize Queue for multiprocessing
# - transform pushes mongoDB operation requests to this queue, which batch_update would listen from
batch_update_connection = Queue()
# start 2 child processes
print("[Main] Starting Transformation process...")
proc_transform = Process(target=transformation.run, args=(mode, None, batch_update_connection, ))
proc_transform.start()
print("[Main] Starting Batch Update process...")
proc_batch_update = Process(target=batch_update.run, args=(mode, batch_update_connection, ))
proc_batch_update.start()
proc_transform.join()
proc_batch_update.join()
# print('mode is '+ mode.value)