Commit baad53c4 authored by Deathcrow's avatar Deathcrow

workaround for pickling bug (?)

parent 619a3927
......@@ -8,6 +8,7 @@ import argparse
import copy
import multiprocessing
import os
import pickle
import re
import random
import signal
......@@ -154,18 +155,21 @@ def clean_up():
if args.cpunetlog != "":
cpunetlog.terminate()
for i in sender:
subprocess.Popen(["kill", "-9", i['utility_data'][0]])
# if i['utility'].returncode == None:
try:
i['utility'].kill()
except ProcessLookupError:
pass
# try:
# i['utility'].kill()
# except ProcessLookupError:
# pass
# i['utility_file'].close()
time.sleep(1)
def start_utility(sender_key, scheduled_time):
time.sleep(abs(scheduled_time - time.perf_counter()))
return subprocess.Popen(sender[sender_key]['utility_command'],
process = subprocess.Popen(sender[sender_key]['utility_command'],
stdout=sender[sender_key]['utility_file'])
data = [process.pid, process.args]
return data
......@@ -318,8 +322,8 @@ with multiprocessing.Pool(len(sender)) as pool:
#time.sleep(5)
for key, i in enumerate(sender):
# i['thread'].join()
i['utility'] = pool_results[key].get()
print(i['utility'].args)
i['utility_data'] = pool_results[key].get()
print(i['utility_data'][1])
......@@ -332,7 +336,7 @@ if args.utility != "netperf":
line = ss_file.readline()
while line is not "":
for key, i in enumerate(sender):
if re.search(str(i['utility'].pid), line):
if re.search(str(i['utility_data'][0]), line):
start = re.search(i['src'], line).end()+1
print(line[start:start+5])
i['src_port'] = line[start:start+5]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment