/Coding-Sample-Python

An example of balancing loads on a mock implementation of a cluster of machines. There is also a parallel Java project, 'Coding-Sample-Java'.

Primary LanguagePythonApache License 2.0Apache-2.0

Code Sample for Ed Cardinal

This project is a ‘mock’ implementation in Python of a cluster of machines running differing loads. This code is intended only to be a very simple example of my approach to coding and coding style, and is not intended to be seen as a finished product or exhaustive treatment of the subject. I have made commentary notes throughout the code in various places where I could make improvements in the future.

Example Application Overview:

The mock cluster has a number of nodes, each with its own load value. The load could represent any common load measurement (CPU, disk, etc.), and is represented by an integer. The loads are periodically monitored in a separate thread. The loads are randomly ‘unbalanced’ then re-balanced twice. The output includes the balancing activity as it occurs and a dump of the monitoring threads at the end.