Hey! This repository contains the server code for the rest based distributed computing task. This readme contains information about dependencies and how to run the program The code was written using Python 3.5
Name: Smarth Katyal
TCD Student ID: 17306092
Email: [email protected]
- Python 3.5 (Performance with earlier versions is untested)
- Windows based System (Hard Requirement because pragram internally uses shell commands like mkdir,chdir,etc. )
- PIP - Python Package Manager (Will be used to install other dependencies)
- Flask (pip install Flask)
- Flask-RESTful (pip install Flask-RESTful)
- requests (pip install requests)
- lizard (pip install lizard)
- Open the file CyclomaticComplexity/com/delegator/master.py in any text editor and change self.totalSlaves = 1 to the number of slaves desired.
- Save and close the file.
- Open the file CycloCalculator/com/analyzer/slave.py in any text editor and change masterip="127.0.0.1" to IP address of the server where you will run master.py
- Save and close the file.
- No steps required
- Navigate to CyclomaticComplexity/com/delegator/ and run the below command
py master.py
- Navigate to CycloCalculator/com/analyzer/ and run the below command
py slave.py
- Repeat step 2 'N' times where 'N' is the number of slaves you entered during configuration. By Default it is 1, so you will need to run step two only once.
- The slave sends a request to the master to ask for the repository of which it needs to calculate the complexity.
- The master responds with the URL of the git repo. For demo purpose, we are using the below git repository(Java):
https://github.com/smart-fun/XmlToJson- The slave initiates a pull of the repo and confirms to master.
- After getting confirmation from all slaves that they are ready, the master starts a timer and sends each slave a different commit id for which the complexity is to be calculated
- After the slave is finished calculating, it sends the calculated value to the master.
- When the master gets a response from all slaves, it stops the timer & it calculates the average complexity and returns.
Conclusion uploaded in pdf document-'conclusion.pdf'.