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).
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.
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).