Skip to content

Commit ffac645

Browse files
committed
Fixed the zombie problem
1 parent 8c560de commit ffac645

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

bin/wfbench

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ def kill_process_and_children(proc):
5252
for child in children:
5353
child.kill()
5454
parent.kill()
55+
5556
except psutil.NoSuchProcess:
5657
pass # Process is already dead
5758

59+
5860
def log_info(msg: str):
5961
"""
6062
Log an info message to stderr
@@ -213,7 +215,7 @@ def cpu_mem_benchmark(cpu_queue: multiprocessing.Queue,
213215
if core:
214216
os.sched_setaffinity(mem_proc.pid, {core})
215217

216-
return cpu_proc, mem_proc
218+
return [cpu_proc, mem_proc]
217219

218220

219221
def io_read_benchmark_user_input_data_size(inputs,
@@ -467,7 +469,7 @@ def main():
467469
log_debug(f"{args.name} acquired core {core}")
468470

469471
mem_threads=int(10 - 10 * args.percent_cpu)
470-
cpu_proc, mem_proc = cpu_mem_benchmark(cpu_queue=cpu_queue,
472+
[cpu_proc, mem_proc] = cpu_mem_benchmark(cpu_queue=cpu_queue,
471473
cpu_threads=int(10 * args.percent_cpu),
472474
mem_threads=mem_threads,
473475
cpu_work=int32_max**2 if args.time else int(args.cpu_work),

tests/test_helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=
9090
working_dir=working_dir,
9191
user="wfcommons",
9292
tty=True,
93-
detach=True
93+
detach=True,
94+
init=True # For zombies
9495
)
9596

9697
# Installing WfCommons on container
@@ -165,4 +166,4 @@ def _compare_workflows(workflow_1: Workflow, workflow_2: Workflow):
165166
# sys.stderr.write(f"WORKFLOW2 OUTPUT FILE: {output_file.file_id} {output_file.size}\n")
166167
workflow2_output_bytes += output_file.size
167168
assert (workflow1_input_bytes == workflow2_input_bytes)
168-
assert (workflow1_output_bytes == workflow2_output_bytes)
169+
assert (workflow1_output_bytes == workflow2_output_bytes)

0 commit comments

Comments
 (0)