Skip to content

Commit

Permalink
validations and fixes for singularity setup
Browse files Browse the repository at this point in the history
  • Loading branch information
replikation committed May 5, 2020
1 parent 8b237ed commit 84922e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
12 changes: 10 additions & 2 deletions bin/download_singularity.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
grep "withLabel:" $1 | cut -f2 -d "'" > .container_list.tmp
grep "withLabel:" $1 | cut -f2 -d "'" > .container_list.tmp
cachedir="$2"

while read container; do
singularity pull --dir $cachedir docker://${container}
name=${container//[\:\/]/-}

if [ -e ${cachedir}/${name}.img ]
then
echo "${name}.img image exists"
else
singularity pull --name ${name}.img --dir "${cachedir}" "docker://${container}"
fi

done < ".container_list.tmp"
7 changes: 6 additions & 1 deletion modules/setup_container.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
process setup_container {
label 'noContainer'
def slash = "/"
def cachdirloc = workflow.launchDir + slash + params.cachedir
println cachdirloc
println slash
input:
file(config_file)
output:
Expand All @@ -12,8 +16,9 @@ process setup_container {
touch everything_done.txt
"""
else if (workflow.profile.contains('singularity'))

"""
download_singularity.sh ${config_file}
download_singularity.sh ${config_file} ${workflow.launchDir}/${params.cachedir}
touch everything_done.txt
"""
Expand Down
11 changes: 7 additions & 4 deletions phage.nf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ println " $params.databases\u001B[0m"
if (workflow.profile.contains('singularity')) {
println "\033[2mSingularity cache location [--cachedir]:"
println " $params.cachedir"
println " "
println "\u001B[33m WARNING: Singularity image building sometimes fails!"
println " Rerun WtP via -resume to retry the failed image build"
println " Please download all images first via --setup --cachedir IMAGE-LOCATION"
println " Manually remove faulty images in $params.cachedir for a rebuild\u001B[0m"
}
println " "
Expand Down Expand Up @@ -691,6 +692,8 @@ def helpMSG() {
""".stripIndent()
}

workflow.onComplete {
log.info ( workflow.success ? "\nDone! Results are stored here --> $params.output \n" : "Oops .. something went wrong" )
}
if (!params.setup) {
workflow.onComplete {
log.info ( workflow.success ? "\nDone! Results are stored here --> $params.output \n" : "Oops .. something went wrong" )
}
}

0 comments on commit 84922e4

Please sign in to comment.