Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Home work This assignment puts together pickling and networks to build a simple distributed service. Use TCP to coordinate between a host and a
The Home work This assignment puts together pickling and networks to build a simple distributed service. Use TCP to coordinate between a host and a server. The host will send a pickled object and the python source to the server. The server will run the python source with the pickle and return the results. Since the purpose of this exercise is to write the communication code, we'll keep it simple. One server, and its program should add two numbers together and return them The object that gets pickled should have a 'result' entry. The application the server runs should have a run method and send its pickled output (after invoking run) to stdout (sys.stdout) 1 use sys.argv to get the name of the pickled input 2 unpickle it 3 invoke the object's run method 4 pickle it to sys.stdout. (There is a reason for this.) You'll need to manually start both the host and server. (a full package like MPI has a method to start and synchronize servers.) Use localhost (127.0.0.1) for the IP address. It may be convenient to use two ports and make both host and server a tep client and a tcp server Host Create the link to the server. Create an instance of the data object, pickle it and send it to the server along with the python code needed to run the calculation. Wait for a reply. Unpickle the reply and print the result Server Listen for the host's message. Receive both the pickled object and the python code - write them as files. Invoke the python code with the pickled file as a command line argument Invoke the python code (HINT use the subprocess package and subprocess.check.output method to do this.) Return the pickled output to the host This sounds really complicated but you've done all the steps in previous homeworks (You have done them, haven't you?) The Home work This assignment puts together pickling and networks to build a simple distributed service. Use TCP to coordinate between a host and a server. The host will send a pickled object and the python source to the server. The server will run the python source with the pickle and return the results. Since the purpose of this exercise is to write the communication code, we'll keep it simple. One server, and its program should add two numbers together and return them The object that gets pickled should have a 'result' entry. The application the server runs should have a run method and send its pickled output (after invoking run) to stdout (sys.stdout) 1 use sys.argv to get the name of the pickled input 2 unpickle it 3 invoke the object's run method 4 pickle it to sys.stdout. (There is a reason for this.) You'll need to manually start both the host and server. (a full package like MPI has a method to start and synchronize servers.) Use localhost (127.0.0.1) for the IP address. It may be convenient to use two ports and make both host and server a tep client and a tcp server Host Create the link to the server. Create an instance of the data object, pickle it and send it to the server along with the python code needed to run the calculation. Wait for a reply. Unpickle the reply and print the result Server Listen for the host's message. Receive both the pickled object and the python code - write them as files. Invoke the python code with the pickled file as a command line argument Invoke the python code (HINT use the subprocess package and subprocess.check.output method to do this.) Return the pickled output to the host This sounds really complicated but you've done all the steps in previous homeworks (You have done them, haven't you?)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started