From: Kefu Chai Date: Mon, 13 Apr 2020 04:43:35 +0000 (+0800) Subject: teuthology: pass integer as "tries" to safe_while() X-Git-Tag: 1.1.0~130^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1445%2Fhead;p=teuthology.git 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 --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 6a6cde0bf..45ddcbd60 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 059c94688..70128ce62 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()