Skip to content

Commit c3eb988

Browse files
Cosmetic: auto reset to 1 thread on macOS and Python 3.8 to prevent the crash #175
1 parent 0199e6c commit c3eb988

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

Diff for: CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- proper assembly coloring in the MetaQUAST HTML report for more than 14 assemblies;
1717
- catching the Krona charts crashes prematurely;
1818
- proper checking of user BED files in the read alignment mode;
19+
- prevent crashes due to multi-threading on macOS and Python 3.8+ (switch to single-thread);
1920
- cosmetic changes in warning/error messages.
2021

2122
5. Documentation:

Diff for: quast_libs/log.py

-18
Original file line numberDiff line numberDiff line change
@@ -201,29 +201,11 @@ def error(self, message='', exit_with_code=0, to_stderr=False, indent='', fake_i
201201
self._num_nf_errors += 1
202202

203203
def exception(self, e, exit_code=0):
204-
# FIXME: special case: handling the known bug of macOS & Python3.8+ & joblib
205-
# see: https://github.com/ablab/quast/issues/175
206-
extra_message = ''
207-
if type(e) == TypeError and 'NoneType' in str(e) and 'int' in str(e):
208-
if qconfig.max_threads and qconfig.max_threads > 1 and qconfig.platform_name == 'macosx' and \
209-
sys.version_info.major == 3 and sys.version_info.minor >= 8:
210-
extra_message = '\n\nThis seems to be a known bug when using multi-threading in Python 3.8+ on macOS!\n' \
211-
'The current workarounds are\n' \
212-
' to switch to single-thread execution (-t 1)\n' \
213-
'or\n' \
214-
' to downgrade your Python to 3.7 or below.\n' \
215-
'Sorry for the inconvenience!\n' \
216-
'Please find more details in https://github.com/ablab/quast/issues/175\n'
217-
218204
if self._logger.handlers:
219205
self._logger.error('')
220206
self._logger.exception(e)
221-
if extra_message:
222-
self._logger.info(extra_message)
223207
else:
224208
sys.stderr.write(str(e) + '\n')
225-
if extra_message:
226-
sys.stderr.write(extra_message + '\n')
227209

228210
if exit_code:
229211
exit(exit_code)

Diff for: quast_libs/qconfig.py

+8
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ def set_max_threads(logger):
314314
max_threads = DEFAULT_MAX_THREADS
315315
logger.notice('Maximum number of threads is set to ' + str(max_threads) +
316316
' (use --threads option to set it manually)')
317+
# FIXME: special case: handling the known bug of macOS & Python3.8+ & joblib
318+
# see: https://github.com/ablab/quast/issues/175
319+
if max_threads > 1 and platform_name == 'macosx' and sys.version_info.major == 3 and sys.version_info.minor >= 8:
320+
max_threads = 1
321+
logger.warning('Maximum number of threads is reset to 1 to prevent the crash '
322+
'due to a known bug when using multi-threading in Python 3.8+ on macOS! '
323+
'For multi-threading please downgrade your Python to 3.7. Sorry for the inconvenience! '
324+
'Please find more details in https://github.com/ablab/quast/issues/175')
317325

318326

319327
def quast_version():

0 commit comments

Comments
 (0)