def _rename_main_thread():
"""
This aims to address the fact that joblib wrongly detects uWSGI workers
as running in the non main thread even when they are not
see https://github.com/joblib/joblib/issues/180
"""
import threading
if isinstance(threading.current_thread(), threading._MainThread) and \
threading.current_thread().name != 'MainThread':
print('Warning: joblib: renaming current thread {} to "MainThread".'
.format(threading.current_thread().name))
threading.current_thread().name = 'MainThread'
评论列表
文章目录