mathutil: Disable queuelogger in background_coordinate_descent()

If the queuelogger was holding the lock when the process is forked
then any attempt to log from the background process would result in a
deadlock.  Attempt a workaround by disabling the queuelogger at the
start of the background process.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-12-17 09:51:45 -05:00
parent d9cd524aec
commit abf493496c
2 changed files with 17 additions and 4 deletions

View file

@ -1,9 +1,10 @@
# Simple math helper functions
#
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging, multiprocessing, traceback
import queuelogger
######################################################################
@ -51,6 +52,7 @@ def coordinate_descent(adj_params, params, error_func):
def background_coordinate_descent(printer, adj_params, params, error_func):
parent_conn, child_conn = multiprocessing.Pipe()
def wrapper():
queuelogger.clear_bg_logging()
try:
res = coordinate_descent(adj_params, params, error_func)
except: