CSE 531_Project_gRPC Overview and Rubric Document CSE 531: Distributed and Multiprocessor Operating Systems gRPC Project Purpose The goal of this project is to build a distributed banking system that...

1 answer below »
gRPC coding project questions


CSE 531_Project_gRPC Overview and Rubric Document CSE 531: Distributed and Multiprocessor Operating Systems gRPC Project Purpose The goal of this project is to build a distributed banking system that allows multiple customers to withdraw or deposit money from the multiple branches in the bank. We assume that there are no concurrent updates on the same resources (money) in the bank, and no customer accesses multiple branches. Each branch maintains a replica of the money that needs to be consistent with the replicas in other branches. customer only communicates with only a specific branch that has the same unique ID with the customer. Although each customer independently updates a specific replica, the replicas stored in each branch need to reflect all the updates made by the customer. Objectives Students will be able to: ● Define a service in a .proto file. ● Generate server and client code using the protocol buffer compiler. ● Use the Python gRPC API to write a simple client and server for your service. ● Build a distributed system that meets specific criteria. ● Determine the problem statement. ● Identify the goal of the problem statement. ● List relevant technologies for the setup and their versions. ● Explain the implementation processes. ● Explain implementation results. Technology Requirements ● Access to Github ● Python ● gRPC ● The basic templates for Customer and Branch processes are provided as “Customer.py” and “Branch.py” can be found within the project description in the course. ● Personal computer with 8 GB RAM or higher. Must be able to install virtual machines on this computer (VMware). Helpful Resources ● gRPC Quick Start Guide Directions Part 1: Written Report Your written report must be a single PDF with the correct naming convention: Your Name_gRPCF_Written Report. Using the provided Student Template_Your Name_gRPCF_Written Report, compose a report addressing the questions: 1. What is the problem statement? 2. What is the goal of the problem statement? 3. What are the relevant technologies for the setup and their versions? 4. What are the implementation processes? 5. What are the implementation results and their justifications? *Students may add subheadings on the template to purposefully call attention to specific, organized details. Part 2: Project Code The project code may be submitted as a .zip file of your source code or as a text file with a source repository link to your source code. Major Tasks 1. Implement the customer and branch processes using Python processes 2. Implement the communication between the processes using gRPC 3. Implement the interfaces (Query, Deposit, and Withdraw) that are used between the customer processes and the branch processes 4. Implement the interfaces (Propogate_Deposit and Propogate_Withdraw) that are used between branch processes 2 https://ets.engineering.asu.edu/vmware/ https://grpc.io/docs/quickstart/python/ Diagram A: Topology of the Banking System 1. Description In the first part of this project, you will implement an interface using gRPC so that the processes can communicate with each other. 1.1. gRPC The communication is implemented with the RPC that we have learned in our previous lecture (Unit 3 Module 2 Lecture 1). We will be using the simplest type of RPC in gRPC, where the customer sends a single request and gets back a single response. 1. The client process calls the method on the stub/client object, the server process is notified that the RPC has been invoked with the client’s metadata for this call, the method name, and the specified deadline if applicable. 2. The server can then either send back its own initial metadata (which must be sent before any response) straight away, or wait for the client’s request message - which happens first is application-specific. 3. Once the server has the client’s request message, it does whatever work is necessary to create and populate its response. The response is then returned (if successful) to the client together with status details (status code and optional status message) and optional trailing metadata. 4. If the status is OK, the client then gets the response, which completes the call on the client side. gRPC Quick Start Guide explains the basic Python programmer’s introduction to working with gRPC using a simple program. We strongly encourage you to refer to this resource. 3 https://grpc.io/docs/quickstart/python/ 1.2. Customer and Branch Processes The basic templates for Customer and Branch processes are provided as “Customer.py” and “Branch.py”. Students are expected to complete the function Customer.createStub and Customer.executeEvents in the Customer.py and use it to generate Customer processes. Customers use the Customer.createStub to communicate with the Branch process with the ID identical to the Customer. Customer.executeEvents processes the events from the list of events stored in the Customer class and submits the request to the Branch process. Additionally, students are expected to complete the Branch.MsgDelivery of the Branch.py and use it to generate Branch processes. Branch.MsgDelivery processes the requests received from other processes and returns results to the requested process. Students should complete the described functions and the Customer and Branch to complete this assignment. 1.3. Branch to Customer Interface Branch.MsgDelivery receives the request from the Customer process. The Branch process should decrease or increase its amount of money, Branch.balance, according to the Customer’s request. The customer stubs of the Branches are stored as a list in the Branch.stubList of the Branch class. ➔ Branch.Query interface reads the value from the Branch.balance and returns the result back to the Customer process. ➔ Branch.Withdraw interface decreases the Branch.balance with the amount specified in the Client’s request, propagates the request to its fellow branches, and returns success / fail to the Customer process. ➔ Branch.Deposit interface increases the Branch.balance with the amount specified in the Client’s request, propagates the request to its fellow branches, and returns success / fail to the Customer process. 1.4. Branch to Branch Interface Branch.MsgDelivery receives the request from its fellow branches that propagate the updates. The Branch process should decrease or increase its replica, Branch.balance, according to the branches' request. ➔ Branch.Propogate_Withdraw interface decreases the Branch.balance with the amount specified in the Branch’s request and returns success / fail to the Branch process. ➔ Branch.Propogate_Deposit interface increases the Branch.balance with the amount specified in the Branch’s request and returns success / fail to the Branch process. Input and Output Formats The input file contains a list of Customers and Branch processes. The number of customers should be identical to the number of branch processes. The list of events that will be stored in Customer.events is described within the Customer’s description. Every Customer.event contains a Query event to check the consistency of the replica. The Branch.balance is described within the Branch's description. The initial value of the Branch.balance is identical among all the descriptions of the Branch processes. 4 [ // Start of the Array of Branch and Customer processes { // Customer process #1 "id" : {a unique identifier of a customer or a branch}, "type" : “customer”, "events" : [{"interface":{query | deposit | withdraw}, "money": {an integer value}, “id“: {unique identifier of an event} “dest” {a unique identifier of the branch} } ] } { … } // Customer process #2 { … } // Customer process #3 { … } // Customer process #N { // Branch process #1 "id" : {a unique identifier of a customer or a branch}, “type” : “branch” “balance” : {replica of the amount of money stored in the branch} } { … } // Branch process #2 { … } // Branch process #3 { … } // Branch process #N ] // End of the Array of Branch and Customer processes The output contains the list of successful responses from the Branch process. All the requested events should return successfully back to the Customer, and the “money” value from the final query request of each Customer should be identical to pass the assignment. [ // Start of the Array of Customer processes { // Customer process #1 “Id” : { a unique identifier of a customer } “recv” {a list of successful returns of the events from the Branch process} } { … } // Customer process #2 { … } // Customer process #3 { … } // Customer process #N ] // End of the Array of Customer processes Below is an example input file and the expected output file. Note that the final query event sleeps for three seconds to guarantee all the updates are propagated among the Branch processes. Example of the input file [ { "id" : 1, "type" : "customer", "events" : [{ “id”: 1, "interface":"query", "money": 400 }] }, { 5 "id" : 2, "type" : "customer", "events" : [{ “id”: 2, "interface":"deposit", "money": 170 },{ “id”: 3, "interface":"query", "money": 400 }] }, { "id" : 3, "type" : "customer", "events" : [{ “id”: 4, "interface":"withdraw", "money": 70 },{ “id”: 5, "interface":"query", "money": 400 }] }, { "id" : 1, "type" : "branch", "balance" : 400 }, { "id" : 2, "type" : "branch", "balance" : 400 }, { "id" : 3, "type" : "branch", "balance" : 400 } ] Expected output file: Expected output file: {'id': 1, 'recv': [{'interface': 'query', 'result': 'success', 'money': 500}]} {'id': 2, 'recv': [{'interface': 'deposit', 'result': 'success'}, {'interface': 'query', 'result': 'success', 'money': 500}]} {'id': 3, 'recv': [{'interface': 'withdraw', 'result': 'success'}, {'interface': 'query', 'result': 'success', 'money': 500}]} Submission Directions for Project Deliverables You must submit your deliverables in the designated submission space in the course. Students may not email or use other means to submit the project for course team review and grading. Students should review the academic integrity and plagiarism policies prior to beginning this project. Your gRPC Project includes two (2) deliverables: 1. gRPC Project Written Report: Your written report must be a single PDF with the correct naming convention: Your Name_gRPC_Written Report. 2. gRPC Project Code: The project code may be submitted as a .zip file of your source code or as a text file with a source repository link to your source code. Final submissions missing either of the deliverables will be graded based on what was submitted against the rubric criteria. Please review the rubric for how your gRPC Project will be graded. 6 There is an automatic 20% grade penalty for each day late past the deadline. Rubric Rubrics communicate specific criteria for evaluation. Prior to starting any graded coursework, you are expected to read through the rubric, so you know how you will be assessed. You are encouraged to self-assess your work and make informed revisions before submitting. Engaging in this learning practice will support you in developing your highest quality deliverables. Points may be deducted at the discretion of the course team for disorganized submissions that convolute the grading process. Component No Attempt Undevelope d Developing Approaching Proficient Exemplary gRPC Project Written Report Part 1: Determine the problem statement Provided no
Answered 3 days AfterOct 20, 2021

Answer To: CSE 531_Project_gRPC Overview and Rubric Document CSE 531: Distributed and Multiprocessor Operating...

Swapnil answered on Oct 24 2021
125 Votes
94238/Solution/code/bank_pb2.py
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descript
or.FileDescriptor(
name='bank.proto',
package='unary',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\nbank.proto\x12\x05unary\"\x1a\n\x07Message\x12\x0f\n\x07message\x18\x01 \x01(\t\"E\n\x0fMessageResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x0f\n\x07\x62\x61lance\x18\x02 \x01(\x05\x12\x10\n\x08received\x18\x03 \x01(\x08\x32K\n\x10\x42\x61nkMicroService\x12\x37\n\x0bMsgDelivery\x12\x0e.unary.Message\x1a\x16.unary.MessageResponse\"\x00\x62\x06proto3'
)
_MESSAGE = _descriptor.Descriptor(
name='Message',
full_name='unary.Message',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='message', full_name='unary.Message.message', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=21,
serialized_end=47,
)
_MESSAGERESPONSE = _descriptor.Descriptor(
name='MessageResponse',
full_name='unary.MessageResponse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='message', full_name='unary.MessageResponse.message', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='balance', full_name='unary.MessageResponse.balance', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='received', full_name='unary.MessageResponse.received', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here