08.06.2015 Views

Building Machine Learning Systems with Python - Richert, Coelho

Building Machine Learning Systems with Python - Richert, Coelho

Building Machine Learning Systems with Python - Richert, Coelho

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12<br />

We need to create a new ssh key <strong>with</strong> the following:<br />

starcluster createkey mykey -o .ssh/mykey.rsa<br />

Now that we have configured a 16 node cluster and set up the keys, let's try it out.<br />

starcluster start mycluster<br />

This may take a few minutes as it allocates 17 new machines. Why 17 when our<br />

cluster is only 16 nodes? We always have a master node. All of these nodes have<br />

the same filesystem, so anything we create on the master will also be seen by the<br />

slaves. This also means that we can use jug on these clusters.<br />

These clusters can be used as you wish, but they come pre-equipped <strong>with</strong> a job<br />

queue engine, which makes them ideal for batch processing. The process of using<br />

them is simple:<br />

1. You log in to the master node.<br />

2. You prepare your scripts on the master (or better yet, have them prepared<br />

before hand).<br />

3. You submit jobs to the queue. A job can be any Unix command. The<br />

scheduler will find free nodes and run your job.<br />

4. You wait for the jobs to finish.<br />

5. You read the results on the master node. You can also now kill all the slave<br />

nodes to save money. In any case, do not forget that your system is running<br />

over the long term. Otherwise, this will cost you (in the dollars and cents<br />

meaning of the word).<br />

We can log in to the master node <strong>with</strong> a single command:<br />

starcluster sshmaster mycluster<br />

We could also have looked up the address of the machine that was generated and<br />

used an ssh command as we did earlier, but when using the preceding command,<br />

it does not matter what the address was, as starcluster takes care of it behind the<br />

scenes for us.<br />

As we said earlier, starcluster provides a batch queuing system for its clusters; you<br />

write a script to perform your actions, put it on the queue, and it will run in any<br />

available node.<br />

At this point, you will need to repeat the actions to install the needed packages<br />

on the cluster. If this was a real project, we would set up a script to perform all<br />

the initialization for us, but since it is a tutorial, you should just run the installation<br />

steps again.<br />

[ 257 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!