Hi all, I’m working on a module that outputs a .p...
# nf-test
g
Hi all, I’m working on a module that outputs a .parquet file, but the file is compressed in a non-deterministic way, so its binary content changes each run and snapshot comparisons fail. What is the recommended nf-core testing approach for non-deterministic outputs like parquet files? Should we skip snapshotting the parquet and only test the
versions
output, or is there a known pattern for handling this? Thanks!
m
One path to go down is to make an nf-test plugin that specializes on parquet files. Otherwise just checking the existence is the minimum possible solution
j
(maybe you can use the nf-parquet plugin to read the resulting file and read/filter it https://nextflow-io.github.io/nf-parquet/)
💥 4
u
Thank you @Jorge I tried this. I don’t remember if I was successful or not. I also don’t remember the exact issue but maybe the issue was that Nextflow plugin functions are not accessible in nf-test files? I am not sure.
I ended up adding a pipeline parameter to save the final outputs as CSV or parquet. In prod, I used parquet and in testing including nf-test I used CSV along with the nft-csv plugin.
s
we need to confirm this...does anyone know of a nf-core module that produces parquet files ?
j
I'll try to create (my first) nf-test plugin similar to nft-csv
🎉 4
👌 2
excited
a
We in nf-core/pixelator have a local module that produces parquet files and we run into the same issue. We develop the software inside the module though, so our solution is to only check that the files exists during the module tests. Content validation is done with some more tests on the software side, where testing is done with pytest and where we have more granularity to write the tests we need
✅ 1
s
We do check just for file existence in many modules with non-deterministic contents already. But if Jorge is willing to make the plugin that'd be great 😉
j
🍌 2
g
Thanks everyone! 😊 I’ll keep it simple and just check for the existence of the parquet file in the tests for now. Really appreciate the guidance — I’ll keep an eye on the new plugin development too!
j
nft-parquet@0.0.1 is ready see it in action at https://github.com/incsteps/nft-parquet/blob/main/nf-test/tests/hello.nf.test#L22 (the pipeline use nf-parquet to write a parquet file and the test use nft-parquet to check it contains 3 rows) in case you want more funcionalities I'll be more than happy to (try) implement them
this 3
🙏 4