galaxyproject / galaxy

Data intensive science for everyone.
https://galaxyproject.org
Other
1.41k stars 1.01k forks source link

Add support for Singularity InteractiveTools/Environments #10012

Open mshamash opened 4 years ago

mshamash commented 4 years ago

Many HPC clusters do not support Docker and instead offer Singularity. As such, it's currently impossible to use any of the InteractiveTools / Interactive Environments on instances where Galaxy is running on an HPC node.

Are there any plans to add support for Singularity containers in the future?

jmchilton commented 4 years ago

While we would love to see this in Galaxy, it is not currently on our roadmap. I think the abstractions inside of Galaxy would make it possible as long as Singularity has a clean way to do the port mapping. Last we looked at it - that didn't seem to be possible but perhaps it is now - https://sylabs.io/guides/3.0/user-guide/networking.html#network-virtualization.

pcm32 commented 3 years ago

You currently can do things like portmap, as in:

$ sudo singularity instance start --writable-tmpfs \
    --net --network-args "portmap=8080:80/tcp" docker://nginx web2

would this be sufficient @jmchilton ? Could you tells us which would be the entry points in the galaxy codebase where such support would need to be added to attempt a first implementation? I was looking around in the code and besides the interactive tools manager, I couldn't find anything that showed the action of sending the interactive tool to run on docker (to understand how to add support for singularity).

Or is it that now it is possible to run interactive tools on a remote k8s cluster?

Running interactive tools on singularity would facilitate things on our HPC setups.

mvdbeek commented 3 years ago

@pcm32 Check out the original PR, https://github.com/galaxyproject/galaxy/pull/7494/, in particular you would need to add the equivalent changes to build_singularity_run_command https://github.com/mvdbeek/galaxy/blob/c052ee503426ab40e2f7d0adc09fe3ad8f66d6e8/lib/galaxy/tool_util/deps/singularity_util.py#L32 that would consume guest_ports and container_name. You then need to adjust lib/galaxy_ext/container_monitor/monitor.py to write out the port text in container_runtime.json.

I think that might be most of what you need to do, but the logic relies on opening a random free port on the host, not sure if singularity can do this ? If not you would need to wrap the singularity command with equivalent logic.