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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.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/iossim/iossim.gyp ('k') | testing/legion/client_rpc_methods.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Defines the client library.""" 5 """Defines the client library."""
6 6
7 import argparse 7 import argparse
8 import datetime 8 import datetime
9 import logging 9 import logging
10 import os 10 import os
11 import socket 11 import socket
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 import threading 15 import threading
16 import xmlrpclib 16 import xmlrpclib
17 17
18 #pylint: disable=relative-import 18 #pylint: disable=relative-import
19 import common_lib 19 import common_lib
20 20
21 THIS_DIR = os.path.dirname(os.path.abspath(__file__)) 21 ISOLATE_PY = os.path.join(common_lib.SWARMING_DIR, 'isolate.py')
22 SWARMING_DIR = os.path.join(THIS_DIR, '..', '..', 'tools/swarming_client') 22 SWARMING_PY = os.path.join(common_lib.SWARMING_DIR, 'swarming.py')
23 ISOLATE_PY = os.path.join(SWARMING_DIR, 'isolate.py')
24 SWARMING_PY = os.path.join(SWARMING_DIR, 'swarming.py')
25 23
26 24
27 class Error(Exception): 25 class Error(Exception):
28 pass 26 pass
29 27
30 28
31 class ConnectionTimeoutError(Error): 29 class ConnectionTimeoutError(Error):
32 pass 30 pass
33 31
34 32
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 ]) 193 ])
196 194
197 self._ExecuteProcess(cmd) 195 self._ExecuteProcess(cmd)
198 196
199 def _ExecuteProcess(self, cmd): 197 def _ExecuteProcess(self, cmd):
200 """Executes a process, waits for it to complete, and checks for success.""" 198 """Executes a process, waits for it to complete, and checks for success."""
201 logging.debug('Running %s', ' '.join(cmd)) 199 logging.debug('Running %s', ' '.join(cmd))
202 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 200 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
203 _, stderr = p.communicate() 201 _, stderr = p.communicate()
204 if p.returncode != 0: 202 if p.returncode != 0:
205 stderr.seek(0)
206 raise Error(stderr) 203 raise Error(stderr)
207 204
208 def OnConnect(self, ip_address): 205 def OnConnect(self, ip_address):
209 """Receives client ip address on connection.""" 206 """Receives client ip address on connection."""
210 self._ip_address = ip_address 207 self._ip_address = ip_address
211 self._connected = True 208 self._connected = True
212 self._rpc = common_lib.ConnectToServer(self._ip_address) 209 self._rpc = common_lib.ConnectToServer(self._ip_address)
213 logging.info('%s connected from %s', self._name, ip_address) 210 logging.info('%s connected from %s', self._name, ip_address)
214 self._connect_event.set() 211 self._connect_event.set()
OLDNEW
« no previous file with comments | « testing/iossim/iossim.gyp ('k') | testing/legion/client_rpc_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698