From 125d414061df7ded88df910cd62983861629c887 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 13 Apr 2020 12:43:35 +0800 Subject: [PATCH] teuthology: pass integer as "tries" to safe_while() in Python3, `a / b` could return a float, and `safe_while()` uses `itertools.islice()` under the hood, where `stop` should be None or an integer. so let's use `a // b` instead. Signed-off-by: Kefu Chai --- teuthology/misc.py | 2 +- teuthology/orchestra/run.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 6a6cde0b..45ddcbd6 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -863,7 +863,7 @@ def wait_until_healthy(ctx, remote, ceph_cluster='ceph', use_sudo=False): 'ceph-coverage', '{tdir}/archive/coverage'.format(tdir=testdir)] args.extend(cmd) - with safe_while(tries=(900 / 6), action="wait_until_healthy") as proceed: + with safe_while(tries=(900 // 6), action="wait_until_healthy") as proceed: while proceed(): out = remote.sh(args, logger=log.getChild('health')) log.debug('Ceph health: %s', out.rstrip('\n')) diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 059c9468..70128ce6 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -485,7 +485,7 @@ def wait(processes, timeout=None): if timeout: log.info("waiting for %d", timeout) if timeout and timeout > 0: - with safe_while(tries=(timeout / 6)) as check_time: + with safe_while(tries=(timeout // 6)) as check_time: not_ready = list(processes) while len(not_ready) > 0: check_time() -- 2.47.3