Skip to content

Commit

Permalink
Use the requester project for file upload
Browse files Browse the repository at this point in the history
- Update the container base image
- Update the default container image
- Respect the requester project for log upload
  • Loading branch information
DonFreed committed Jul 11, 2023
1 parent b6b11cc commit 6e61ebe
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
6 changes: 3 additions & 3 deletions pipeline_scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM google/cloud-sdk:367.0.0-slim as downloader
FROM google/cloud-sdk:437.0.1-slim as downloader

# Install samtools
RUN apt-get update && \
Expand All @@ -22,9 +22,9 @@ RUN curl -Lo samblaster-v.0.1.24.tar.gz https://github.com/GregoryFaust/samblast
make && \
cp samblaster /usr/local/bin/

FROM google/cloud-sdk:367.0.0-slim
FROM google/cloud-sdk:437.0.1-slim

LABEL container.base.image="google/cloud-sdk:367.0.0-slim"
LABEL container.base.image="google/cloud-sdk:437.0.1-slim"

COPY --from=downloader /usr/local/bin/samtools /usr/local/bin
COPY --from=downloader /usr/local/bin/samblaster /usr/local/bin
Expand Down
6 changes: 3 additions & 3 deletions pipeline_scripts/gc_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ upload_metrics()
eval "fun_metrics_cmd2=\$$fun_var_cmd2"
if [[ -n "$fun_metrics_cmd2" && -z "$fun_metrics_cmd1" && -f "${fun_metrics_files[0]}" ]]; then
(run "$fun_metrics_cmd2" "Plotting metrics results." &&
gsutil cp ${fun_metrics_files[@]} "$out_metrics" &&
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp ${fun_metrics_files[@]} "$out_metrics" &&
rm ${fun_metrics_files[@]}) &
eval "$fun_pid=$! "
eval "$fun_var_cmd2=''"
Expand Down Expand Up @@ -297,7 +297,7 @@ bwa_mem_align()
fi
bwa_cmd="$bwa_cmd | $release_dir/bin/sentieon util sort ${fun_util_sort_xargs} --block_size 512M -o $local_bam -t $nt --sam2bam -i -"
run "$bwa_cmd" "BWA-mem and sorting"
gsutil cp $bwa_log "$out_bam"
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $bwa_log "$out_bam"
fun_bam_dest+=($local_bam)
done
echo "BWA ended"
Expand Down Expand Up @@ -444,7 +444,7 @@ run_bqsr_post()
run "$cmd" "BQSR post"
run "$fun_bqsr_cmd3" "BQSR CSV"
run "$fun_bqsr_cmd4" "BQSR plot"
gsutil cp $fun_plot "$out_metrics" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $fun_plot "$out_metrics" &
eval "$fun_upload_pid=$1 "
fi

Expand Down
12 changes: 6 additions & 6 deletions pipeline_scripts/gc_germline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ output_ext="bam"
run_mark_duplicates "" "$DEDUP" metrics_cmd1 "$local_bams_str" dedup_bam_str dedup_bams "$dedup_xargs" $output_ext "false" "${local_bams[@]}"
if [[ "$DEDUP" != "nodup" ]]; then
if [[ -z "$NO_METRICS" ]]; then
(gsutil cp $metrics_dir/dedup_metrics.txt "$out_metrics" &&
(gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $metrics_dir/dedup_metrics.txt "$out_metrics" &&
rm $metrics_dir/dedup_metrics.txt) &
upload_dedup_pid=$!
else
Expand Down Expand Up @@ -131,7 +131,7 @@ if [[ -z "$NO_BAM_OUTPUT" && (-z "$bqsr_sites" || -z "$RECALIBRATED_OUTPUT" ) ]]
upload_list+=" \"${bam}.crai\" "
fi
done
eval gsutil cp $upload_list "$out_bam" &
eval gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $upload_list "$out_bam" &
upload_deduped_pid=$!
fi

Expand All @@ -146,12 +146,12 @@ if [[ -n "$bqsr_sites" && -z "$NO_BAM_OUTPUT" && -n "$RECALIBRATED_OUTPUT" ]]; t
outrecal=$work/recalibrated.bam
cmd="$release_dir/bin/sentieon driver $dedup_bam_str -q $bqsr_table --algo ReadWriter $outrecal"
(run "$cmd" "ReadWriter";
gsutil cp $outrecal ${outrecal}.bai "$out_bam") &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $outrecal ${outrecal}.bai "$out_bam") &
upload_recal_pid=$!
fi

if [[ -n "$bqsr_sites" && -z "$NO_BAM_OUTPUT" && -z "$RECALIBRATED_OUTPUT" ]]; then
gsutil cp $bqsr_table "$out_bam" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $bqsr_table "$out_bam" &
upload_bqsr_pid=$!
fi

Expand Down Expand Up @@ -218,7 +218,7 @@ if [[ -z $NO_HAPLOTYPER ]]; then
run "$cmd" "DNAscope model apply"
fi

gsutil cp $outfile ${outfile}.tbi "$out_variants" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $outfile ${outfile}.tbi "$out_variants" &
upload_vcf_pid=$!
fi

Expand All @@ -240,7 +240,7 @@ fi
if [[ -n $bqsr_cmd3 ]]; then
run "$bqsr_cmd3" "BQSR CSV"
run "$bqsr_cmd4" "BQSR plot"
gsutil cp $plot "$out_metrics" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $plot "$out_metrics" &
upload_bqsr_metrics_pid=$!
fi

Expand Down
14 changes: 7 additions & 7 deletions pipeline_scripts/gc_somatic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if [[ "$DEDUP" != "nodup" ]]; then
if [[ -n "$dedup_bam_str" ]]; then
to_upload+=" $metrics_dir/normal_dedup_metrics.txt"
fi
(gsutil cp $to_upload "$out_metrics" &&
(gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $to_upload "$out_metrics" &&
rm $metrics_dir/*_dedup_metrics.txt) &
upload_dedup_pid=$!
else
Expand Down Expand Up @@ -188,7 +188,7 @@ if [[ -z "$NO_BAM_OUTPUT" && -z "$REALIGN_SITES" ]]; then
upload_list+=" \"${bam}.crai\" "
fi
done
eval gsutil cp $upload_list "$out_bam" &
eval gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $upload_list "$out_bam" &
upload_deduped_pid=$!
fi

Expand Down Expand Up @@ -254,7 +254,7 @@ if [[ -n "$realigned_bam_str" ]]; then
fi

if [[ -n "$bqsr_sites" && -z "$NO_BAM_OUTPUT" ]]; then
gsutil cp $bqsr_table $tumor_bqsr_table "$out_bam" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $bqsr_table $tumor_bqsr_table "$out_bam" &
upload_bqsr_pid=$!
fi

Expand Down Expand Up @@ -296,7 +296,7 @@ if [[ -n "$REALIGN_SITES" && -n "$RUN_TNSNV" && -n "$realigned_bam_str" ]]; then
elif [[ -f "${corealigned_bam}.crai" ]]; then
upload_list+=" ${corealigned_bam}.crai "
fi
gsutil cp $upload_list "$out_bam" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $upload_list "$out_bam" &
upload_corealigned_pid=$!

corealigned_bam_str=" -i $corealigned_bam "
Expand All @@ -310,7 +310,7 @@ elif [[ -n "$REALIGN_SITES" && -n "$RUN_TNSNV" ]]; then
upload_list+=" \"${bam}.crai\" "
fi
done
eval gsutil cp $upload_list "$out_bam" &
eval gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $upload_list "$out_bam" &
upload_corealigned_pid=$!

corealigned_bam_str=" $tumor_realigned_bam_str "
Expand Down Expand Up @@ -350,7 +350,7 @@ if [[ -z "$NO_VCF" ]]; then
fi

run "$cmd" "Variant calling"
gsutil cp $vcf ${vcf}.tbi "$out_variants" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $vcf ${vcf}.tbi "$out_variants" &
upload_vcf_pid=$!
fi

Expand Down Expand Up @@ -382,7 +382,7 @@ if [[ -n $tumor_bqsr_cmd3 ]]; then
fi
run "$tumor_bqsr_cmd3" "Tumor BQSR CSV"
run "$tumor_bqsr_cmd4" "Tumor BQSR plot"
gsutil cp $upload_list $tumor_bqsr_plot "$out_metrics" &
gsutil ${REQUESTER_PROJECT:+-u $REQUESTER_PROJECT} cp $upload_list $tumor_bqsr_plot "$out_metrics" &
upload_bqsr_metrics_pid=$!
fi

Expand Down
2 changes: 1 addition & 1 deletion runner/runner_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"CPU_PLATFORM": "Intel Broadwell",
"PROJECT_ID": null,
"REQUESTER_PROJECT": null,
"DOCKER_IMAGE": "sentieon/sentieon-google-cloud:0.2.4",
"DOCKER_IMAGE": "sentieon/sentieon-google-cloud:0.2.6",
"CALLING_ARGS": null,
"CALLING_ALGO": "Haplotyper",
"DNASCOPE_MODEL": "https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.0.model",
Expand Down
11 changes: 8 additions & 3 deletions runner/sentieon_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,16 @@ def main(
"/bin/bash",
"-c",
(
"gsutil cp /google/logs/action/1/stderr "
"gsutil -u {} cp /google/logs/action/1/stderr "
'"{}/worker_logs/stderr.txt" && '
"gsutil cp /google/logs/action/1/stdout "
"gsutil -u {} cp /google/logs/action/1/stdout "
'"{}/worker_logs/stdout.txt"'
).format(job_vars["OUTPUT_BUCKET"], job_vars["OUTPUT_BUCKET"]),
).format(
job_vars["REQUESTER_PROJECT"],
job_vars["OUTPUT_BUCKET"],
job_vars["REQUESTER_PROJECT"],
job_vars["OUTPUT_BUCKET"]
),
],
"alwaysRun": True,
}
Expand Down

0 comments on commit 6e61ebe

Please sign in to comment.