From 571772a5027a99da1188d9dd80cf8318113131b0 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Tue, 21 Jan 2020 11:34:09 +0200 Subject: [PATCH] scylla_node: _update_jmx_pid: print Timed out message only if wait=True We get benign Timed out messages when stopping a node before scylla-jmx started running and we explicitly pass wait=False for this reason. Signed-off-by: Benny Halevy --- ccmlib/scylla_node.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ccmlib/scylla_node.py b/ccmlib/scylla_node.py index fe1a6fef..43429495 100644 --- a/ccmlib/scylla_node.py +++ b/ccmlib/scylla_node.py @@ -549,12 +549,14 @@ def _update_jmx_pid(self, wait=True): start = time.time() while not (os.path.isfile(pidfile) and os.stat(pidfile).st_size > 0): - if time.time() - start > 30.0 or not wait: - print_("Timed out waiting for pidfile {} to be filled (after {} seconds): File {} size={}".format( - pidfile, - 0 if not wait else time.time() - start, - 'exists' if os.path.isfile(pidfile) else 'does not exist' if not os.path.exists(pidfile) else 'is not a file', - os.stat(pidfile).st_size if os.path.exists(pidfile) else -1)) + elapsed = time.time() - start + if elapsed > 30.0 or not wait: + if wait: + print_("Timed out waiting for pidfile {} to be filled (after {} seconds): File {} size={}".format( + pidfile, + elapsed, + 'exists' if os.path.isfile(pidfile) else 'does not exist' if not os.path.exists(pidfile) else 'is not a file', + os.stat(pidfile).st_size if os.path.exists(pidfile) else -1)) break else: time.sleep(0.1)