Hi, i am a bit confused by the `bwamem2_index` mod...
# help
n
Hi, i am a bit confused by the
bwamem2_index
module behaviour, it requests memory, based on
memory { 280.MB * _Math_.ceil(fasta.size() / 10000000) * task.attempt }
. However, on AWS it OOMs even on attempt 3. The log states:
ref seq len = 315317090
which I assume is the length of the sequence. By my math (
315317090*280/10000000
), this should request 8.828 MB * task.attempt, but according to the AWS metrics for this job it requested 3.3 GB for the third (1.1GB per attempt). This also was not an issue before, so I am a bit confused whats going wrong.
m
Check if
fasta
is
List
? or there is a variable
fasta
in that process.
n
fasta
is an input:
tuple val(meta), path(fasta)
m
Is that
path
a
List
object or a
Path
object?
Path
also implements the
List
interface too I think so iterators work on it, so it might be checking that
fasta.size()
is actually the file size and not the number of
/
+ 1
n
You mean the number of
/
in the path? That is either 0 (input filename) or 6 (full path). I think that this tries to estimate sequence length, based on filesize. Idk how reliable that is, I guess it is ok if sequence characters >>> header (which is the case). I also hope that
file.size()
checks the size of the of the source file, and not that of the symlink?
But, tbh if it was the symlink I guess it would be much lower
However, I realized that I am passing a bgzipped file to bwamem2.
bwamem2
seems to be fine with that, but it may interfere with the calculation of required ram?
Which would also match to an observation I made during a local testrun, but did not think about much:
m
So you need a compression scaling factor then if zipped?
n
That is what I am guessing
could you take a look at this patch (pipeline) github.com/nf-core/genomeassembler/pull/230 ? I will then retrigger the aws test
Thanks
Do you think this should be patched in modules? Imo the module is actually fine, it specifies that it expects fasta input in meta.yml?
s
Yeah, probably needs fixing in modules
m
I think it's a good idea. You can do a test on the file ending and then return triple the amount of memory if it ends in gz/bz2
( also since when did we start baking in memory optimisations into modules )?
n
The scaling * 3 is a wild guess tbh
s
I think it is just the bwa index family, as they have a well characterised dependency
m
@Niklas Schandry. gzip consistently compresses files ~3x, it’s fine to hardcode that
πŸ™ŒπŸ½ 1
πŸ‘ 1
n
If I can figure out why i cannot test locally, and manage to fix it i will open a pr ;)
So, with a 3x scaling, my AWS test still had 1 failed BWAMEM2_INDEX process. Maybe 4x scaling would be more conservative?
s
Yeah
πŸ‘ 1
n