From: Zack Cerza Date: Thu, 1 Sep 2016 15:11:28 +0000 (-0600) Subject: copy_to_log(): Drop use of readlines() X-Git-Tag: 1.1.0~538^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c12d9a32ed82e15ae8c25b00f8fc612ce64b303;p=teuthology.git copy_to_log(): Drop use of readlines() http://tracker.ceph.com/issues/17102 Fixes: 17102 Calling readlines() on the source object causes the teuthology thread to block on the remote command's execution. Instead, iterate over the source object as advised at: https://docs.python.org/2.7/library/stdtypes.html#file.xreadlines This interface is also supported by StringIO and cStringIO. Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 4754cb5ee..43c9eb8ec 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -237,14 +237,11 @@ def quote(args): def copy_to_log(f, logger, loglevel=logging.INFO): - """ - Interface to older xreadlines api. - """ # Work-around for http://tracker.ceph.com/issues/8313 if isinstance(f, ChannelFile): f._flags += ChannelFile.FLAG_BINARY - for line in f.readlines(): + for line in f: line = line.rstrip() # Second part of work-around for http://tracker.ceph.com/issues/8313 try: