Programming Assignment Solution

$30.00

Description

Running

This program uses python3. It will not work with python2.

Running the service is two step process:

1. Start the desired number of servers

1. change the directory with `phase1.py`

2. Follow the instructions below for your operating system to run the server

2. Start and run the client with deisred commands

1. A jupyter notebook called `testClient.ipynb` is provided with a set of commands

2. Special instructions are given below for running on macOS

Server

# Linux

“`

python phase1.py –uniAddr 127.0.0.1

“`

# macOS

“`

python phase1.py –uniAddr <Private IP Address> –IS_MACOS True

“`

For macOS, the Private IP Address can be found in

System Preferences -> Network -> Advanced -> TCP/IP -> IPv4A Adress

You have to run this program with this address instead of the localhost addres to get it to work.

# Example run

We will start 2 servers here.

Server 1

“`

python phase1.py –uniAddr 127.0.0.1

“`

Server 2

“`

python phase1.py –uniAddr 127.0.0.1

“`

You will see some messages pass between the two servers, accepting eachother into the group.

Client

The client is in the attached “`.ipynb“` file. Start jupyter notebook. If you are running on macOS, be sure to change the IP address for the “`clientAddrPort“` variable to the same Private IP Address used when starting the servers. You should then be able to click play on each cell.

You will observe the two servers communicating in the terminals that you started the servers in and replies to the client in the jupyter notebook.

What works and what doesn’t

Everything described in the write up for part 2 works.

Partition simulation

Partitions are mocked since all servers are run on the same machine. This is done by a `groupID`. If an incoming `groupID` does not match the current `groupID` and the message is not a join message, the message is ignored, simulating a partition. After a set number (3 is hardcoded) of client messages are recieved, then the partitions join and merge their logs.

Sources of potential errors

Its important to set the IP Address to your Private IP Address when running on macOS otherwise it will not run.

Note

* There is a small change form the architecture discussed in class.

* In class we discussed that the client contacts a single server and the server fowards this message to other servers and

the servers then run the sequencing algorithm

* To avoid this extra broadcast step, the client uses server group address to send messages to all servers in the group. The servers use the consensus algorithm to sequence the message among themselves and a single reply from the server choosen to be the sequencer is sent to the client (if a reply is needed, eg: `qTop` function returns int).


error: Content is protected !!