Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: testing/legion/client_rpc_methods.py

Issue 890773003: Adding the initial code for Omnibot multi-machine support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/legion/client_lib.py ('k') | testing/legion/client_rpc_server.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Defines the client RPC methods."""
6
7 import logging
8 import subprocess
9 import threading
10
11
12 class RPCMethods(object):
13 """Class exposing RPC methods."""
14
15 def __init__(self, server):
16 self.server = server
17
18 def Echo(self, message):
19 """Simple RPC method to print and return a message."""
20 logging.info('Echoing %s', message)
21 return 'echo %s' % str(message)
22
23 def Subprocess(self, cmd):
24 """Run the commands in a subprocess.
25
26 Returns:
27 (returncode, stdout, stderr).
28 """
29 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
30 stderr=subprocess.PIPE)
31 stdout, stderr = p.communicate()
32 return (p.returncode, stdout, stderr)
33
34 def Quit(self):
35 """Call server.shutdown in another thread.
36
37 This is needed because server.shutdown waits for the server to actually
38 quit. However the server cannot shutdown until it completes handling this
39 call. Calling this in the same thread results in a deadlock.
40 """
41 t = threading.Thread(target=self.server.shutdown)
42 t.start()
OLDNEW
« no previous file with comments | « testing/legion/client_lib.py ('k') | testing/legion/client_rpc_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698