Giter Club home page Giter Club logo

ipydocker's Introduction

IPyDocker

IPyDocker aims to (even further) simplify Python parallelization tasks. It uses Docker containers and IPython parallelization capabilities.

https://raw.github.com/miha-stopar/IPyDocker/master/ipydocker.png

Why

This approach is about having IPython ipcontroller on one machine and IPython ipengine instances inside Docker Linux containers on some further physical machines. Docker containers can be hosted on the same machine as controller too, but it doesn't make any sense as this implies an unneeded overhead - you can simply use IPython without Docker for such a setup. However, if you would like to exploit IPython parallelization capabilities using more than one physical machine, you can use Docker containers to simplify the configuration and to isolate the worker environment.

How to

Clone IPyDocker repo on the physical machines you want to use as workers and execute the command below. This will prepare a Docker virtual machine with some preinstalled libraries (numpy, scipy, scikit-learn...). Modify Dockerfile if you wish to have other libraries.

docker build -t krop-img .

Create IPython profile on a controller machine:

ipython profile create --parallel --profile=myprofile

Go into .ipython/profile_myprofile and set the controller IP in ipcontroller_config.py:

HubFactory.ip = '192.168.1.14'

Run controller:

ipcontroller --reuse --profile myprofile

Prepare worker machines - execute the following command to start the Docker container on each of the worker machines:

docker run -d krop-img

Copy ipcontroller-engine.json from .ipython/profile_myprofile/security to the workers. You can see the port number if you execute docker ps.

scp -P 49185 ipcontroller-engine.json [email protected]://root/

Connect to workers (the password is krop - see the Dockerfile where it is set):

ssh [email protected] -p 49185

Start one or more ipengines on each worker:

ipengine --file=/root/ipcontroller-engine.json

Now you can delegate tasks to workers from the controller machine:

from IPython.parallel import Client
c = Client(profile="myprofile")
# print out the ids of the ipengines on worker machines:
print c.ids
# execute some dummy command inside each ipengine:
c[:].apply_sync(lambda : "Hello World")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.