deisseroth-lab / two-photon

Common scripts, libraries, and utilities for 2p experiments
5 stars 6 forks source link

Can't run ripper in parallel due to Xvfb issue #7

Open tbenst opened 3 years ago

tbenst commented 3 years ago

When running more than one singularity or docker containers, I get xvfb-run: error: Xvfb failed to start See https://stackoverflow.com/questions/30332137/xvfb-run-unreliable-when-multiple-instances-invoked-in-parallel for an explanation.. for docker I think the culprit is https://github.com/deisseroth-lab/two-photon/blob/32cc9d5cf2e705949dfb82581c7f0c3ae5f9e50f/rip_docker.sh#L35

jmdelahanty commented 2 years ago

Edit: It looks like you need to remove the xvfb environment specifications for this to work. I couldn't get it to run without removing them from the docker run command.

Related to this issue, It seems that if you do something like this in your setup you can spawn multiple containers from calling the script once:

Shell script:

sudo docker run \
       --rm \
       --volume=$2:/data \
       --volume=/scratch:/tmp \
       --volume=/snlkt/data/bruker_pipeline/logs:/logs \
       --env=USER_NAME=${USER} \
       --env=USER_UID=$(id -u ${USER}) \
       --env=USER_GID=$(id -g ${USER}) \
       --env=USER_HOME=${HOME} \
       --workdir=/home/${USER} \
       --env=TZ=America/Los_Angeles \
       --cpus 2 \
       --shm-size=1g \
       --name=$1 \
       snlkt-bruker-ripper:latest \
       /apps/runscript.sh $3 $4 $log_filename

runscript.sh command:

${CMDPREFIX} -a /usr/bin/python3 /apps/rip.py --directory $1 --ripper_version $2 --log_file $3

The -a command sets the xvfb-run step to Auto, so it will search for an available port and then select it for the virtual buffer! It works on the Salk cluster now at least in Docker, unsure if it will work with a Singularity container.