Skip to content

Commit 8eea2f9

Browse files
committed
threads default = 1 + handle CalledProcessError by giving error message
1 parent 950ba21 commit 8eea2f9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

viloca/b2w.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,23 @@ def parallel_run_one_window(
588588
_write_to_file([line], f"coverage_{idx}.txt")
589589

590590

591+
import subprocess
591592
def run_window_wrapper(args):
592-
return parallel_run_one_window(*args)
593+
try:
594+
return parallel_run_one_window(*args)
595+
except subprocess.CalledProcessError as e:
596+
# Capture critical error details
597+
error_msg = f"""
598+
Subprocess failed in window {args[3]} (index {args[4]})
599+
Command: {e.cmd}
600+
Exit code: {e.returncode}
601+
Error output: {e.stderr.decode().strip()}
602+
"""
603+
logging.critical(error_msg)
604+
605+
# Reraise with context for pytest reporting
606+
raise RuntimeError(f"Window processing failed: {error_msg}") from e
607+
593608

594609

595610
def build_windows(alignment_file: str, tiling_strategy: TilingStrategy,

viloca/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def main():
169169
default=True, dest="keep_files", help="keep all intermediate files")
170170

171171
parser_shotgun.add_argument("-t", "--threads", metavar='INT', required=False,
172-
type=int, dest="maxthreads", default=0,
172+
type=int, dest="maxthreads", default=1,
173173
help="limit maximum number of parallel threads\n(0: CPUs count-1, n: limit to n)")
174174

175175
parser_shotgun.add_argument("-z", "--insert-file", metavar='INSERT_FILE', type=str,

0 commit comments

Comments
 (0)