@@ -88,7 +88,7 @@ def delete_tail_params(params):
88
88
params ['output' ].close ()
89
89
print (f"{ params ['identifier' ]} { params ['lfn' ]} closed" )
90
90
91
- def make_logfile_params (verbose , logfile , trace ):
91
+ def make_logfile_params (verbose , logfile , trace , temp_dir ):
92
92
""" create the structure to work with logfiles """
93
93
return {
94
94
"trace_io" : True ,
@@ -97,8 +97,10 @@ def make_logfile_params(verbose, logfile, trace):
97
97
"verbose" : verbose ,
98
98
"output" : logfile .open ('wb' ),
99
99
"identifier" : "" ,
100
- "lfn" : str (logfile )
100
+ "lfn" : str (logfile ),
101
+ "temp_dir" : temp_dir
101
102
}
103
+
102
104
def logfile_line_result (wait , line , params ):
103
105
""" Write the line to a logfile, print progress. """
104
106
# pylint: disable=pointless-statement
@@ -269,19 +271,19 @@ def __init__(self, config, connect_instance, deadline_signal=-1):
269
271
else :
270
272
self .deadline_signal = signal .SIGINT
271
273
272
- def dig_for_children (self ):
274
+ def dig_for_children (self , params ):
273
275
""" manual search for children that may be there without the self.pid still being there """
274
276
children = []
275
277
for process in psutil .process_iter (["pid" , "ppid" , "name" ]):
276
- if process .ppid () == self . pid :
278
+ if process .ppid () == params [ ' pid' ] :
277
279
children .append (process )
278
280
elif (process .ppid () == 1 and
279
281
(process .name ().lower ().find ('arango' ) >= 0 or
280
282
process .name ().lower ().find ('tshark' ) >= 0 )):
281
283
children .append (process )
282
284
return children
283
285
284
- def get_environment (self ):
286
+ def get_environment (self , params ):
285
287
""" hook to implemnet custom environment variable setters """
286
288
return os .environ .copy ()
287
289
@@ -357,10 +359,7 @@ def run_monitored(self,
357
359
children = []
358
360
if identifier == "" :
359
361
# pylint: disable=global-statement
360
- global ID_COUNTER
361
- my_no = ID_COUNTER
362
- ID_COUNTER += 1
363
- identifier = f"IO_{ str (my_no )} "
362
+ identifier = f"IO_{ str (params .my_id )} "
364
363
print (params )
365
364
params ['identifier' ] = identifier
366
365
if not isinstance (deadline ,datetime ):
@@ -376,10 +375,10 @@ def run_monitored(self,
376
375
stderr = PIPE ,
377
376
close_fds = ON_POSIX ,
378
377
cwd = self .cfg .test_data_dir .resolve (),
379
- env = self .get_environment ()
378
+ env = self .get_environment (params )
380
379
) as process :
381
380
# pylint: disable=consider-using-f-string
382
- self . pid = process .pid
381
+ params [ ' pid' ] = process .pid
383
382
queue = Queue ()
384
383
thread1 = Thread (
385
384
name = f"readIO { identifier } " ,
@@ -452,15 +451,15 @@ def run_monitored(self,
452
451
try :
453
452
children = children + process .children (recursive = True )
454
453
rc_exit = process .wait (timeout = 1 )
455
- children = children + self .dig_for_children ()
454
+ children = children + self .dig_for_children (params )
456
455
add_message_to_report (
457
456
params ,
458
457
f"{ identifier } exited unexpectedly: { str (rc_exit )} " ,
459
458
True , True )
460
459
kill_children (identifier , params , children )
461
460
break
462
461
except psutil .NoSuchProcess :
463
- children = children + self .dig_for_children ()
462
+ children = children + self .dig_for_children (params )
464
463
add_message_to_report (
465
464
params ,
466
465
f"{ identifier } exited unexpectedly: { str (rc_exit )} " ,
@@ -502,7 +501,7 @@ def run_monitored(self,
502
501
try :
503
502
process .send_signal (self .deadline_signal )
504
503
except psutil .NoSuchProcess :
505
- children = children + self .dig_for_children ()
504
+ children = children + self .dig_for_children (params )
506
505
print_log (f"{ identifier } process already dead!" , params )
507
506
elif have_deadline > 1 and datetime .now () > final_deadline :
508
507
try :
0 commit comments