refactor: accept settings as input

This commit is contained in:
Moritz E. Beber 2022-05-08 16:05:51 +02:00
parent 46a9aabfa3
commit f6936e5270
2 changed files with 4 additions and 7 deletions

View file

@ -9,10 +9,11 @@ process SRATOOLS_PREFETCH {
input:
tuple val(meta), val(id)
path(ncbi_settings)
output:
tuple val(meta), path(id), emit: sra
path "versions.yml" , emit: versions
path 'versions.yml' , emit: versions
when:
task.ext.when == null || task.ext.when
@ -20,7 +21,5 @@ process SRATOOLS_PREFETCH {
shell:
args = task.ext.args ?: ''
args2 = task.ext.args2 ?: '5 1 100' // <num retries> <base delay in seconds> <max delay in seconds>
config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
template 'retry_with_backoff.sh'
}

View file

@ -40,10 +40,8 @@ retry_with_backoff() {
echo "${output}"
}
eval "$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')"
if [[ ! -f "${NCBI_SETTINGS}" ]]; then
mkdir -p "$(dirname "${NCBI_SETTINGS}")"
printf '!{config}' > "${NCBI_SETTINGS}"
if [[ "!{ncbi_settings.name}" != "EXISTS" ]]; then
export NCBI_SETTINGS="$PWD/!{ncbi_settings}"
fi
retry_with_backoff !{args2} \