Skip to content

Commit

Permalink
Only mount reference disks if requested [WX-925]
Browse files Browse the repository at this point in the history
  • Loading branch information
mcovarr committed Feb 7, 2023
1 parent 790c892 commit 4debcc3
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version 1.0


workflow ReferenceDiskMountedOnlyIfRequested {
call MentionsNirvanaReference {}
output {
Boolean disk_mounted = MentionsNirvanaReference.disk_mounted
}
}


task MentionsNirvanaReference {
input {
# Tiny 116 byte reference file, certainly not worth attaching a 55 GiB Nirvana reference disk for this.
File mention =
"gs://broad-public-datasets/gvs/vat-annotations/Nirvana/3.18.1/SupplementaryAnnotation/GRCh38/MITOMAP_20200819.nsa.idx"
}
command <<<
PS4='\D{+%F %T} \w $ '
set -o nounset -o xtrace

# Debug output
lsblk

CANDIDATE_MOUNT_POINT=$(lsblk | sed -E -n 's!.*(/mnt/[a-f0-9]+).*!\1!p')

if [[ ! -z ${CANDIDATE_MOUNT_POINT} ]]; then
echo "Found unexpected mounted disk, investigating further."
find ${CANDIDATE_MOUNT_POINT} -print | tee find.out

if grep -i nirvana find.out; then
echo "Found what appears to be a Nirvana reference disk."
else
echo "Found unknown volume mounted, see 'find.out' for manifest."
fi
echo true > disk_mounted.out
else
echo false > disk_mounted.out
fi
>>>
runtime {
docker: "ubuntu:latest"
backend: "Papiv2-Reference-Disk-Localization"
}
output {
Boolean disk_mounted = read_boolean("disk_mounted.out")
File? find_out = "find.out"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: reference_disk_mounted_only_if_requested_false
testFormat: workflowsuccess
backends: [Papiv2-Reference-Disk-Localization]

files {
workflow: reference_disk/reference_disk_mounted_only_if_requested.wdl
options: reference_disk/reference_disk_test_false.options.json
}

metadata {
workflowName: ReferenceDiskMountedOnlyIfRequested
status: Succeeded
"outputs.ReferenceDiskMountedOnlyIfRequested.disk_mounted": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: reference_disk_mounted_only_if_requested_true
testFormat: workflowsuccess
backends: [Papiv2-Reference-Disk-Localization]

files {
workflow: reference_disk/reference_disk_mounted_only_if_requested.wdl
options: reference_disk/reference_disk_test_true.options.json
}

metadata {
workflowName: ReferenceDiskMountedOnlyIfRequested
status: Succeeded
"outputs.ReferenceDiskMountedOnlyIfRequested.disk_mounted": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: reference_disk_mounted_only_if_requested_unspecified
testFormat: workflowsuccess
backends: [Papiv2-Reference-Disk-Localization]

files {
workflow: reference_disk/reference_disk_mounted_only_if_requested.wdl
options: reference_disk/reference_disk_test_unspecified.options.json
}

metadata {
workflowName: ReferenceDiskMountedOnlyIfRequested
status: Succeeded
"outputs.ReferenceDiskMountedOnlyIfRequested.disk_mounted": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ class PipelinesApiAsyncBackendJobExecutionActor(override val standardParams: Sta

val inputFilePaths = inputOutputParameters.jobInputParameters.map(_.cloudPath.pathAsString).toSet
val referenceDisksToMount =
jesAttributes.referenceFileToDiskImageMappingOpt.map(getReferenceDisksToMount(_, inputFilePaths))
if (useReferenceDisks)
jesAttributes.referenceFileToDiskImageMappingOpt.map(getReferenceDisksToMount(_, inputFilePaths))
else None

val workflowOptions = workflowDescriptor.workflowOptions

Expand Down

0 comments on commit 4debcc3

Please sign in to comment.