From 73e2eea4be12ac94b38c55359195799ba2c4cf17 Mon Sep 17 00:00:00 2001 From: Olamide Isreal Date: Tue, 28 Jul 2026 10:05:17 +0100 Subject: [PATCH] Stop staging the 9.2 GB ChEMBL DB into every task workdir GET_FINAL_METABOLITES_STATIC took chembl_db as a `path` input, so Nextflow copied the ~9.2 GB SQLite DB into each task's work directory. With ~29 concurrent tasks that is hundreds of GB of I/O, against a process that also declared only 1 GB of memory. Every task failed with exit 1 and retried ten times, producing 746 errors and an empty 1b_final_metabolites/ output. Pass the DB as a `val` path instead so tasks read it in place from the dreamdock-data PVC, and give the process parameterised growing memory. --- main.nf | 13 ++++++++++++- main_biotransformer.nf | 13 +++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/main.nf b/main.nf index c11dd9c..9eca350 100644 --- a/main.nf +++ b/main.nf @@ -29,6 +29,14 @@ params.bt_max_retries = 10 params.bt_fail_action = 'ignore' // 'terminate' or 'ignore' params.bt_max_forks = 0 // 0 = unlimited, set to N to limit concurrency +// GET_FINAL_METABOLITES_STATIC — queries the ~9.2 GB ChEMBL SQLite DB on the PVC. +// The DB is opened read-only/immutable and is NOT staged into the task workdir, so the +// memory below covers rdkit + the biotransformer CSV, not the database itself. +params.chembl_initial_memory = 4 // GB - starting memory +params.chembl_growth_memory = 4 // GB - additional memory per retry attempt +params.chembl_max_retries = 3 +params.chembl_fail_action = 'ignore' // 'terminate' or 'ignore' after retries exhausted + //CONPLEX params.keep_enst = 'false' //'true' //'false' //to keep individual protein data created by conplex step params.conplex_initial_memory = 5 // GB - starting memory for conplex @@ -121,7 +129,10 @@ workflow { default: println("Invalid mode specified: ${params.mode}") } - chembl_ch = Channel.fromPath(params.chembl_db).collect() + // Pass the ChEMBL DB as a plain path string rather than a staged file: at ~9.2 GB, + // staging it per task copied the DB into every work directory. The process reads it + // read-only from the PVC mount instead. + chembl_ch = Channel.value(params.chembl_db) // GET_FINAL_METABOLITES(HUMAN_TRANSFORMER.out) // TODO: LOCALIZE GET_FINAL_METABOLITES_STATIC(HUMAN_TRANSFORMER.out, chembl_ch) //CONPLEX diff --git a/main_biotransformer.nf b/main_biotransformer.nf index 23ec209..c07e28e 100755 --- a/main_biotransformer.nf +++ b/main_biotransformer.nf @@ -274,18 +274,23 @@ process GET_FINAL_METABOLITES { } process GET_FINAL_METABOLITES_STATIC { - memory 1.GB + // The ChEMBL DB is ~9.2 GB. It is passed as a `val` path (not a staged `path` + // input) so Nextflow does not copy it into every task work directory — with + // concurrent tasks that multiplied into hundreds of GB of I/O. The DB lives on + // the dreamdock-data PVC and is opened read-only/immutable, so sharing one copy + // across tasks is safe. + memory { params.chembl_initial_memory.toInteger().GB + (task.attempt - 1) * params.chembl_growth_memory.toInteger().GB } container "${params.container_chembl}" containerOptions "${params.containerOptions}" publishDir "${params.outdir}/${params.project_name}/1b_final_metabolites", mode: 'copy' - errorStrategy { task.attempt <= 10 ? 'retry' : 'ignore' } - maxRetries 10 + errorStrategy { task.attempt <= params.chembl_max_retries.toInteger() ? 'retry' : params.chembl_fail_action } + maxRetries { params.chembl_max_retries.toInteger() } input: path smiles_csv - path chembl_db // Add ChEMBL SQLite database as input + val chembl_db // Path to the ChEMBL SQLite DB on the PVC (not staged into the workdir) output: path "${smiles_csv.simpleName}.txt"