@@ -23,18 +23,25 @@ def __init__(self, postgres_server_config: PostgresServerConfig, my_workload_con
23
23
24
24
def data_load (self ):
25
25
cwd = os .getcwd ()
26
- if self .my_workload_config .work_directory != "current_directory" :
27
- os .chdir (self .my_workload_config .work_directory )
26
+ self ._change_work_directory ()
28
27
data_load_cmd = self .my_workload_config .data_load_command
29
- logger .debug ('run my workload data load command : {}' .format (data_load_cmd ))
28
+ logger .debug ('Run data_load_command : {}' .format (data_load_cmd ))
30
29
run_command (data_load_cmd )
31
30
if self .my_workload_config .work_directory != "current_directory" :
32
31
os .chdir (cwd )
33
32
34
- def run (self , measurement_time_second : int = None ):
33
+ def warm_up (self ):
35
34
cwd = os .getcwd ()
35
+ self ._change_work_directory ()
36
+ warm_up_command = self .my_workload_config .warm_up_command
37
+ logger .debug ('Run warm_up_command : {}' .format (warm_up_command ))
38
+ run_command (warm_up_command )
36
39
if self .my_workload_config .work_directory != "current_directory" :
37
- os .chdir (self .my_workload_config .work_directory )
40
+ os .chdir (cwd )
41
+
42
+ def run (self , measurement_time_second : int = None ):
43
+ cwd = os .getcwd ()
44
+ self ._change_work_directory ()
38
45
run_workload_command = self .my_workload_config .run_workload_command
39
46
start_number_of_xact_commit = self .get_number_of_xact_commit ()
40
47
workload_start_time = time .time () # start measurement time
@@ -59,6 +66,10 @@ def run(self, measurement_time_second: int = None):
59
66
tps = self .calculate_transaction_per_second (workload_number_of_xact_commit , self .workload_elapsed_time )
60
67
return tps
61
68
69
+ def _change_work_directory (self ):
70
+ if self .my_workload_config .work_directory != "current_directory" :
71
+ os .chdir (self .my_workload_config .work_directory )
72
+
62
73
@staticmethod
63
74
def calculate_transaction_per_second (number_of_xact_commit , elapsed_seconds ):
64
75
return round (number_of_xact_commit / elapsed_seconds , 6 )
0 commit comments