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: input:
tuple val(meta), val(id) tuple val(meta), val(id)
path(ncbi_settings)
output: output:
tuple val(meta), path(id), emit: sra tuple val(meta), path(id), emit: sra
path "versions.yml" , emit: versions path 'versions.yml' , emit: versions
when: when:
task.ext.when == null || task.ext.when task.ext.when == null || task.ext.when
@ -20,7 +21,5 @@ process SRATOOLS_PREFETCH {
shell: shell:
args = task.ext.args ?: '' args = task.ext.args ?: ''
args2 = task.ext.args2 ?: '5 1 100' // <num retries> <base delay in seconds> <max delay in seconds> 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' template 'retry_with_backoff.sh'
} }

View file

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