diff --git a/ccmlib/cluster.py b/ccmlib/cluster.py index 34cd81ad..17edffe1 100644 --- a/ccmlib/cluster.py +++ b/ccmlib/cluster.py @@ -700,5 +700,5 @@ def timed_grep_nodes_for_patterns(self, versions_to_patterns, timeout_seconds, f return ret(node=node, matchings=matchings) time.sleep(1) - def wait_for_any_log(self, pattern, timeout, filename='system.log'): - return common.wait_for_any_log(self.nodelist(), pattern, timeout, filename=filename) + def wait_for_any_log(self, pattern, timeout, filename='system.log', marks=None): + return common.wait_for_any_log(self.nodelist(), pattern, timeout, filename=filename, marks=marks) diff --git a/ccmlib/common.py b/ccmlib/common.py index 6e793414..9fa5b41e 100644 --- a/ccmlib/common.py +++ b/ccmlib/common.py @@ -764,7 +764,7 @@ def is_intlike(obj): raise RuntimeError('Reached end of {}; should not be possible'.format(is_intlike.__name__)) -def wait_for_any_log(nodes, pattern, timeout, filename='system.log'): +def wait_for_any_log(nodes, pattern, timeout, filename='system.log', marks=None): """ Look for a pattern in the system.log of any in a given list of nodes. @@ -775,11 +775,14 @@ def wait_for_any_log(nodes, pattern, timeout, filename='system.log'): but a maximum number of attempts. This implies that the all the grepping takes no time at all, so it is somewhat inaccurate, but probably close enough. + @param marks A dict of nodes to marks in the file. Keys must match the first param list. @return The first node in whose log the pattern was found """ + if marks is None: + marks = {} for _ in range(timeout): for node in nodes: - found = node.grep_log(pattern, filename=filename) + found = node.grep_log(pattern, filename=filename, from_mark=marks.get(node, None)) if found: return node time.sleep(1) diff --git a/ccmlib/dse_cluster.py b/ccmlib/dse_cluster.py index b9f3d276..c18f11a0 100644 --- a/ccmlib/dse_cluster.py +++ b/ccmlib/dse_cluster.py @@ -72,10 +72,13 @@ def create_node(self, name, auto_bootstrap, thrift_interface, storage_interface, def start(self, no_wait=False, verbose=False, wait_for_binary_proto=False, wait_other_notice=True, jvm_args=None, profile_options=None, quiet_start=False, allow_root=False): if jvm_args is None: jvm_args = [] + marks = {} + for node in self.nodelist(): + marks[node] = node.mark_log() started = super(DseCluster, self).start(no_wait, verbose, wait_for_binary_proto, wait_other_notice, jvm_args, profile_options, quiet_start=quiet_start, allow_root=allow_root, timeout=180) self.start_opscenter() if self._misc_config_options.get('enable_aoss', False): - self.wait_for_any_log('AlwaysOn SQL started', 600) + self.wait_for_any_log('AlwaysOn SQL started', 600, marks=marks) return started def stop(self, wait=True, signal_event=signal.SIGTERM, **kwargs):