Skip to content
Snippets Groups Projects
user avatar
Guilhem Saurel authored
60a0993e
History

Example 2

In this example, we have example 1 plus:

  • Adding another Queue so that the boss can get the results back
  • Transmitting numpy objects over the network

Test locally

In one shell: ./manager.py In another: ./boss.py And in many others: ./minion.py

Test on multiple computers

We suppose that the host of the manager will be HOST (e.g. nyusan, CHECK AVAILABILITY before using it), user is USER and docker registery gitlab.laas.fr:4567/USER/multiprocessing-examples

First build and push the docker.

IMAGE="gitlab.laas.fr:4567/$USER/multiprocessing-examples:example-2"
docker build --build-arg HOST=nyusan -t "$IMAGE" .
docker login gitlab.laas.fr:4567  # only required once
docker push gitlab.laas.fr:4567/$USER/multiprocessing-examples:example-2

Launch the manager on your central CPU:

docker run --rm -p 7481:7481 -it "$IMAGE" /app/manager.py

If the boss is not on the local network, forward the port 7481 to the manager CPU:

ssh -L 7481:localhost:7481 $USER@nyusan.laas.fr

Launch the boss on your personal computer, with or without docker.

docker run --rm -it "$IMAGE" /app/boss.py

Then launch the minions on the available CPUs of your network:

docker run --rm -it "$IMAGE"