From 7a02aea67ec6af29825d893b7613ce40eddb90c3 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 11 Jan 2023 08:06:32 +0100 Subject: [PATCH] fix: sleep a random time to work around GNU parallel bug (#328) --- snappy_wrappers/wrappers/bcftools_call/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk3_hc/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk3_ug/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk4_hc/combine_gvcfs/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk4_hc/discover/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk4_hc/genotype/wrapper.py | 2 +- snappy_wrappers/wrappers/gatk4_hc/joint/wrapper.py | 1 + 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/snappy_wrappers/wrappers/bcftools_call/wrapper.py b/snappy_wrappers/wrappers/bcftools_call/wrapper.py index fc24ad7f0..fe1fc662c 100644 --- a/snappy_wrappers/wrappers/bcftools_call/wrapper.py +++ b/snappy_wrappers/wrappers/bcftools_call/wrapper.py @@ -125,7 +125,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk4_hc_joint][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk3_hc/wrapper.py b/snappy_wrappers/wrappers/gatk3_hc/wrapper.py index 7825d7736..851c8b276 100644 --- a/snappy_wrappers/wrappers/gatk3_hc/wrapper.py +++ b/snappy_wrappers/wrappers/gatk3_hc/wrapper.py @@ -108,7 +108,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk3_hc][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk3_ug/wrapper.py b/snappy_wrappers/wrappers/gatk3_ug/wrapper.py index 7cf663a92..44e69d995 100644 --- a/snappy_wrappers/wrappers/gatk3_ug/wrapper.py +++ b/snappy_wrappers/wrappers/gatk3_ug/wrapper.py @@ -109,7 +109,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk3_ug][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk4_hc/combine_gvcfs/wrapper.py b/snappy_wrappers/wrappers/gatk4_hc/combine_gvcfs/wrapper.py index a05d7a25b..aa8aa5030 100644 --- a/snappy_wrappers/wrappers/gatk4_hc/combine_gvcfs/wrapper.py +++ b/snappy_wrappers/wrappers/gatk4_hc/combine_gvcfs/wrapper.py @@ -110,7 +110,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk4_hc_gvcf][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk4_hc/discover/wrapper.py b/snappy_wrappers/wrappers/gatk4_hc/discover/wrapper.py index 876b669b1..55093b145 100644 --- a/snappy_wrappers/wrappers/gatk4_hc/discover/wrapper.py +++ b/snappy_wrappers/wrappers/gatk4_hc/discover/wrapper.py @@ -113,7 +113,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk4_hc_gvcf][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk4_hc/genotype/wrapper.py b/snappy_wrappers/wrappers/gatk4_hc/genotype/wrapper.py index cec8a758f..3747ce00b 100644 --- a/snappy_wrappers/wrappers/gatk4_hc/genotype/wrapper.py +++ b/snappy_wrappers/wrappers/gatk4_hc/genotype/wrapper.py @@ -106,7 +106,7 @@ export -f run-shard # Perform parallel execution -mkdir -p $TMPDIR/parallel +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk4_hc_gvcf][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel --plain -j $num_threads 'run-shard {{#}} {{}}' diff --git a/snappy_wrappers/wrappers/gatk4_hc/joint/wrapper.py b/snappy_wrappers/wrappers/gatk4_hc/joint/wrapper.py index f8a153656..1c2cbb203 100644 --- a/snappy_wrappers/wrappers/gatk4_hc/joint/wrapper.py +++ b/snappy_wrappers/wrappers/gatk4_hc/joint/wrapper.py @@ -111,6 +111,7 @@ export -f run-shard # Perform parallel execution +(set -x; sleep $(echo "scale=3; $RANDOM/32767*10" | bc)s) # sleep up to 10s to work around bug num_threads={snakemake.config[step_config][variant_calling][gatk4_hc_joint][num_threads]} cat $TMPDIR/final_intervals.txt \ | parallel -j $num_threads 'run-shard {{#}} {{}}'