broadinstitute / viral-core

viral-ngs: read QC, barcode metrics, spike-in metrics, Illumina metrics and demux
Other
3 stars 0 forks source link

In cmd.py argparse common_args(), set default number of threads to all available if --threads is unspecified #104

Closed tomkinsc closed 3 months ago

tomkinsc commented 4 months ago

In cmd.py argparse common_args(), set default number of threads to all available if --threads is unspecified; previously if the threads arg were None, it would be up to the consuming function to set the thread count to all available. With this change, the new default is to use all available cores. Additionally, this sanitizes the user-requested thread count via util.misc.sanitize_thread_count(), if a value is specified. This was already the behavior in most multi-threaded functions, by separate calls to util.misc.sanitize_thread_count() where a threads arg is consumed; the latter could potentially be refactored out if we are relying solely on the argparse interface, though it should be preserved for python import usage of the same functions (including some test cases). Changing the default will cause no changes where existing separate sanitize_thread_count() calls are used. This also corrects a call to count_and_sort_barcodes() where the threads arg was not being passed.