Skip to content

Commit

Permalink
fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
jethror1 committed Feb 12, 2024
1 parent cf70964 commit 87e6e05
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ _upload_single_file() {

file_id=$(dx upload "$file" --path "$remote_path" --parents --brief)

if [[ "$link" == true ]]; then
dx-jobutil-add-output "$field" "$file_id" --array
if [[ "$link" == true ]]; then
# flock here ensures we don't try write to the dxoutput.json when uploading in parallel
flock -x -w30 /tmp/add_output.lock dx-jobutil-add-output "$field" "$file_id" --array
fi
}

Expand Down Expand Up @@ -545,9 +546,9 @@ _upload_demultiplex_output() {
fastq_ids=$(cat job_output.json | jq -r '.fastqs[][]')

if [[ "$upload_demultiplex_output" == false ]]; then
# option specified to not upload demultiplex output => remove the job_output file
# option specified to not upload demultiplex output => empty the job_output file
# so that these are removed from the jobs output spec
rm job_output.json
echo "{}" > job_output.json
fi
}

Expand Down Expand Up @@ -614,6 +615,9 @@ _scatter() {
# control how many operations to open in parallel for download / upload
THREADS=$(nproc --all)

# create valid empty JSON file for job output, fixes #19
echo "{}" > job_output.json

mkdir -p /home/dnanexus/TSO500_ruo \
/home/dnanexus/demultiplexOutput/ \
/home/dnanexus/fastqs/ \
Expand Down Expand Up @@ -756,6 +760,9 @@ main() {
# control how many operations to open in parallel for download / upload
THREADS=$(nproc --all)

# create valid empty JSON file for job output, fixes #19
echo "{}" > job_output.json

mkdir -p /home/dnanexus/runfolder \
/home/dnanexus/TSO500_ruo \
/home/dnanexus/out/demultiplexOutput \
Expand Down

0 comments on commit 87e6e05

Please sign in to comment.