-
Notifications
You must be signed in to change notification settings - Fork 0
/
PBP000_main_processor.py
65 lines (49 loc) · 2.47 KB
/
PBP000_main_processor.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
56
57
58
59
60
61
62
63
64
65
"""
FYP : 22013
Module:
Post Benchmark Processor
Description:
This python script executes the necessary code in the Post Benchmark Processor
module to compute the Freshness Scores and Query Latencies for the benchmark
output.
"""
# Imports from built-in modules
import json
import multiprocessing as mp
import sys
# Imports from Post Benchmark Processor Module
from PBP001_freshness_score_processor import Freshness_Score_Processor
from PBP002_query_latency_processor import Query_Latency_Processor
# Calculates Freshness Score for Each Analytical Query
def start_freshness_score_processor(configs):
processor = Freshness_Score_Processor(output_directory_location = configs["post_benchmark_output_directory"],\
freshness_score_results_directory = configs["freshness_score_results_directory"],\
number_of_analytical_threads = configs["number_of_analytical_threads"],\
number_of_transactional_threads = configs["number_of_transactional_threads"])
processor.execute()
# Calculates Latency for Each Query Type
def start_query_latency_processor(configs):
processor = Query_Latency_Processor(output_directory_location = configs["post_benchmark_output_directory"],\
freshness_score_results_directory = configs["freshness_score_results_directory"],\
number_of_analytical_threads = configs["number_of_analytical_threads"],\
number_of_transactional_threads = configs["number_of_transactional_threads"])
processor.execute()
# Calls the functions defined above to complete post-benchmark processing
def start_post_benchmark_processor(configs):
fs_process = mp.Process(target=start_freshness_score_processor, args=(configs,))
ql_process = mp.Process(target=start_query_latency_processor, args=(configs,))
fs_process.start()
ql_process.start()
ql_process.join()
fs_process.join()
if __name__ == '__main__':
# Checking if the number of command line arguments is as expected
if len(sys.argv) == 2:
# starting the post-benchmark processing
config_file = sys.argv[1]
with open(config_file, "r") as f:
configs = json.loads(f.read())
start_post_benchmark_processor(configs)
else:
print("USAGE:", sys.argv[0], "<JSON config file>")
# End of PBP000_main_processor.py