Hi all - I have what I hope is a simple (ish) ques...
# pipeline-maintainers
l
Hi all - I have what I hope is a simple (ish) question. We are noting an issue with one of the tools our pipeline (scnanoseq) implements when it is executed with NextFlow. This is linked to the behavior of not mounting the directory and this particular tool writes in small directory at
$HOME
, and there is currently no parameter within the tool to change this location. We can get around this by enabling the following before the
nextflow run
command -
export NXF_SINGULARITY_HOME_MOUNT=true
. This solves the issue, but I am unsure if there is way for us to streamline this process to users? Or is this just a matter of adding this need in the docs (I noted pixelator has done at the README: https://github.com/nf-core/pixelator)
Since Nextflow 23.07.0-edge, Nextflow no longer mounts the host's home directory when using Apptainer or Singularity. This causes issues in some dependencies. As a workaround, you can revert to the old behavior by setting the environment variable
NXF_APPTAINER_HOME_MOUNT
or
NXF_SINGULARITY_HOME_MOUNT
to
true
in the machine from which you launch the pipeline.
Any feedback is appreciated on what is best for the nf-core community.
<!subteam^S016E36N7TQ>: pinging you all directly if ok on this question ☝️ Thanks! 🙂
n
Hi you could set this environment variable for this process only using `beforeScript`: https://www.nextflow.io/docs/latest/process.html#beforescript
p
That won't work, this is a Nextflow configuration env variable, so needs to be in the environment before Nextflow itself loads
💯 1
n
Ah yes you're right! I didn't see it was a nextflow env 😁
p
I don't completely understand why the external home directory needs to be available to be honest
Why can the software not just write to an ephemeral home directory within the container?
l
The tool is IsoQuant, and related to this: https://github.com/ablab/IsoQuant/blob/fd6407d6f79e9351daf845dc3d575fc4292e94a6/isoquant.py#L696 We will open a feature request to make this section into a param at least and in the longer run hopefully we can remove this requirement. This is not the only tool that does this. BLAZE in our pipeline also does it (same request / PR will go in the future).
The error that we receive from Nextflow without the variable is
OSError: [Errno 30] Read-only file system: '/home/lianov/.config'
as an example
p
aha, so it can see your home directory but not write to it. gotcha
I wonder if you can set
$HOME
inside the container to a path within the work directory, which is writeable 🤔
🤔 1
l
correct
That’s worth a try. I have certainly done this with other tasks in the past via binding but never in Nextflow. Any thoughts on the way we can test this out?
j
we have the same issue in crisprseq, we couldn't find a good solution apart from running the pipeline with
export NXF_SINGULARITY_HOME_MOUNT=true
gratitude thank you 1
p
How irritating. Funny that this thread was almost exactly the same as above with beforeScript 😅
😂 4
Might be worth posting in #CKDDD9JB0 and seeing if anyone there knows how to tell singularity not to mount any home directory (even read only) so that it instead has an ephemeral and writeable home directory.
l
Sounds good will do! If we cannot find a resolution, we will move forward with adding a warning in the documentation as @Júlia Mir has done along with others so we can move forward with a first release (but either way, I will be on the look-out on this for a more permanent solution). Thanks so much all for the feedback here.
👍🏻 1
p
Thanks, sounds good! Yes it'd be nice to have a solution, sounds like several pipelines would benefit..
l
Ok - I seem to have found the solution before contacting the other channel (may still post there out of curiosity and see what they think). Digging through the docs I saw https://www.nextflow.io/docs/latest/process.html#containeroptions So, adding
Copy code
containerOptions "--bind ${task.workDir}:/home"
to IsoQuant’s process now adds the directory it writes to nextflow’s
work
dir (e.g.:
scnanoseq/work/lianov/76/6dac21..../.config/IsoQuant
) So that seems to do the trick for me. @Júlia Mir Is this something you have tried?
👌 3
j
Oh nice! I will try it out too 🙂
👍 1
l
@Júlia Mir: A quick update. In the above, I had forgotten that Docker’s binding option is different from Singularity and Apptainer. So if you proceed with that, the above example is over-simplistic. It should look more like this to make it work across the 3 containers that I have checked (Apptainer, Singularity and Docker):
Copy code
containerOptions "${workflow.containerEngine == 'docker' ?
    '--mount type=bind,source=' + task.workDir.toString() + ',target=/home' :
    '--bind ' + task.workDir.toString() + ':/home'}"
That being I did cross post this in #CKDDD9JB0 as suggested by Phil to see if we had additional options to work with (https://nfcore.slack.com/archives/CKDDD9JB0/p1724879621376119). One solution that also works and I think more simple than the above is in the reply - to add
export HOME=\$(pwd)
to the
script
section of the process. This seemed to work fine on my quick test and was suggested to be the better solution for pipeline maintainers. I am doing a few other tests, but don’t see why this shouldn’t work across the board (and this way we are not dealing with container specific syntax).
🙏🏻 1