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

Unified Diff: client/common_lib/base_barrier.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: client/common_lib/base_barrier.py
diff --git a/client/common_lib/base_barrier.py b/client/common_lib/base_barrier.py
index e4de635fcf6c22ff9073b597833c24b367947681..e1063a912b8ca106ab7c11217b0c55e9e202c306 100644
--- a/client/common_lib/base_barrier.py
+++ b/client/common_lib/base_barrier.py
@@ -5,6 +5,16 @@ from autotest_lib.client.common_lib import error
# default barrier port
_DEFAULT_PORT = 11922
+def get_host_from_id(hostid):
+ # Remove any trailing local identifier following a #.
+ # This allows multiple members per host which is particularly
+ # helpful in testing.
+ if not hostid.startswith('#'):
+ return hostid.split('#')[0]
+ else:
+ raise error.BarrierError(
+ "Invalid Host id: Host Address should be specified")
+
class BarrierAbortError(error.BarrierError):
"""Special BarrierError raised when an explicit abort is requested."""
@@ -159,17 +169,6 @@ class barrier(object):
self._waiting = {} # Maps from hostname -> (client, addr) tuples.
- def _get_host_from_id(self, hostid):
- # Remove any trailing local identifier following a #.
- # This allows multiple members per host which is particularly
- # helpful in testing.
- if not hostid.startswith('#'):
- return hostid.split('#')[0]
- else:
- raise error.BarrierError(
- "Invalid Host id: Host Address should be specified")
-
-
def _update_timeout(self, timeout):
if timeout is not None and self._start_time is not None:
self._timeout_secs = (time() - self._start_time) + timeout
@@ -397,14 +396,14 @@ class barrier(object):
remote.settimeout(30)
if is_master:
# Connect to all slaves.
- host = self._get_host_from_id(self._members[self._seen])
+ host = get_host_from_id(self._members[self._seen])
logging.info("calling slave: %s", host)
connection = (remote, (host, self._port))
remote.connect(connection[1])
self._master_welcome(connection)
else:
# Just connect to the master.
- host = self._get_host_from_id(self._masterid)
+ host = get_host_from_id(self._masterid)
logging.info("calling master")
connection = (remote, (host, self._port))
remote.connect(connection[1])

Powered by Google App Engine
This is Rietveld 408576698