Running jug on our cloud machine

We can now download the data and code for the book by cloning the code repository to your machine:

$ git clone 
https://github.com/PacktPublishing/Building-Machine-Learning-Systems-with-Python-Third-edition

$ cd BuildingMachineLearningSystemsWithPython
$ cd ch14

Finally, we run this following command:

$ jug execute  

This would work just fine, but we would have to wait a long time for the results. Our free tier machine (of type t2.micro) is not very fast and only has a single processor. So, we will upgrade our machine!

We go back to the EC2 console and right-click on the running instance to get the pop-up menu. We need to first stop the instance. This is the virtual machine equivalent to powering off. You can stop your machines at any time. At this point, you stop paying for them. Note that you are still using disk space, which also has a cost, billed separately. You can terminate the instance, which will also destroy the disk. This means you lose any information saved on the machine.

Once the machine is stopped, the Change instance type option becomes available. Now, we can select a more powerful instance, for example, a c5.xlarge instance with eight cores. The machine is still off, so you need to start it again (the virtual equivalent to booting up).

AWS offers several instance types at different price points. As this information is constantly being revised as more powerful options are introduced and prices change (generally, getting cheaper), we cannot give you many details in the book, but you can find the most up-to-date information on Amazon's website.

We need to wait for the instance to come back up. Once it has, look up its IP address in the same fashion as we did before. When you change instance run on types, your instance will get a new address assigned to it.

You can assign a fixed IP to an instance using Amazon.com's Elastic IPs functionality, which you will find on the left-hand side of the EC2 console. This is useful if you find yourself creating and modifying instances very often. There is a small cost associated with this feature.

With 8 cores, you can run 8 jug processes simultaneously, as illustrated in the following code:

$ # the loop below runs 8 times
$ for counter in $(seq 8); do
> jug execute &
> done

Use jug status to check whether these eight jobs are, in fact, running. After your jobs are finished (which should now happen pretty fast), you can stop the machine and downgrade it again to a t2.micro instance to save money. The micro instance
can be used for free (within certain limits), while the c5.xlarge one we used costs 0.170 US dollars per hour (as of June, 2018—check the AWS website for up-to-date information).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset