@@ -44,7 +44,7 @@ def load_script(script_file):
44
44
45
45
class UserGroup (multiprocessing .Process ):
46
46
def __init__ (self , queue , process_num , user_group_name , num_threads ,
47
- script_file , run_time , rampup , user_group_config ):
47
+ script_file , run_time , rampup , user_group_config , global_config ):
48
48
multiprocessing .Process .__init__ (self )
49
49
self .queue = queue
50
50
self .process_num = process_num
@@ -55,6 +55,7 @@ def __init__(self, queue, process_num, user_group_name, num_threads,
55
55
self .rampup = rampup
56
56
self .start_time = time .time ()
57
57
self .user_group_config = user_group_config
58
+ self .global_config = global_config
58
59
59
60
def run (self ):
60
61
# -- ENSURE: (Re-)Import script_module in forked Process
@@ -71,7 +72,7 @@ def run(self):
71
72
self .start_time , self .run_time ,
72
73
self .user_group_name ,
73
74
script_module , self .script_file ,
74
- self .user_group_config )
75
+ self .user_group_config , self . global_config )
75
76
agent_thread .daemon = True
76
77
threads .append (agent_thread )
77
78
agent_thread .start ()
@@ -82,7 +83,7 @@ def run(self):
82
83
83
84
class Agent (threading .Thread ):
84
85
def __init__ (self , queue , process_num , thread_num , start_time , run_time ,
85
- user_group_name , script_module , script_file , user_group_config ):
86
+ user_group_name , script_module , script_file , user_group_config , global_config ):
86
87
threading .Thread .__init__ (self )
87
88
self .queue = queue
88
89
self .process_num = process_num
@@ -93,6 +94,7 @@ def __init__(self, queue, process_num, thread_num, start_time, run_time,
93
94
self .script_module = script_module
94
95
self .script_file = script_file
95
96
self .user_group_config = user_group_config
97
+ self .global_config = global_config
96
98
97
99
# choose most accurate timer to use (time.clock has finer granularity
98
100
# than time.time on windows, but shouldn't be used on other systems).
@@ -107,8 +109,10 @@ def run(self):
107
109
spec = inspect .getargspec (self .script_module .Transaction .__init__ )
108
110
if len (spec .args ) == 1 and spec .varargs is None and spec .keywords is None :
109
111
trans = self .script_module .Transaction ()
110
- else :
112
+ elif len ( spec . args ) == 2 :
111
113
trans = self .script_module .Transaction (self .user_group_config )
114
+ else :
115
+ trans = self .script_module .Transaction (self .user_group_config , self .global_config )
112
116
trans .custom_timers = {}
113
117
114
118
# scripts have access to these vars, which can be useful for loading unique data
0 commit comments