mycobactopia-org / MTBseq-nf

MTBSeq made simple and easy using Nextflow and nf-core standard.
https://doi.org/10.5281/zenodo.5498063
MIT License
8 stars 1 forks source link

Add a sleeper process for stubs #12

Closed abhi18av closed 3 years ago

abhi18av commented 3 years ago

I am adding a call to sleep process for each of the stubs to make them behave more like a real world workflow i.e. some processes complete earlier and send their output to the channel faster than others, this we can test the dataflow aspect of nextflow.

This idea I took from the issue which was highlighted in BACTpipe https://github.com/ctmrbio/BACTpipe/issues/170#issuecomment-863224237and was resolved using the join operator on channels.

Mxrcon commented 3 years ago

It's a very nice addition, thanks for your work on that @abhi18av! Will merge as it seems ok, maybe we should tweak the time, not sure! But let's see.

abhi18av commented 3 years ago

maybe we should tweak the time

The sleep will be between 1 - 10 seconds at random.

We could have also used shuf as mentioned here https://blog.eduonix.com/shell-scripting/generating-random-numbers-in-linux-shell-scripting/

I went ahead with $RANDOM since there was already some tested code with this in the BACTpipe one.

Mxrcon commented 3 years ago

The sleep will be between 1 - 10 seconds at random. Yes, what I'm not certain is if 1-10 is time enough, how was your testing using it?

In my opinion using $RANDOM seems a good way to generating them so no problem with that.