def wait_for_query_state(self, vector, stmt, state, max_retry=15): """Checks the in flight queries on Impala debug page. Polls the state of the query statement from parameter every second until the query gets to a state given via parameter or a maximum retry count is reached. Restriction: Only works if there is only one in flight query.""" impalad_service = ImpaladService(get_impalad_host_port(vector).split(':')[0]) if not impalad_service.wait_for_num_in_flight_queries(1): raise Exception("No in flight query found") retry_count = 0 while retry_count <= max_retry: query_info = impalad_service.get_in_flight_queries()[0] if query_info['stmt'] != stmt: exc_text = "The found in flight query is not the one under test: " + \ query_info['stmt'] raise Exception(exc_text) if query_info['state'] == state: return retry_count += 1 sleep(1.0) raise Exception("Query didn't reach desired state: " + state)
def wait_for_query_state(self, stmt, state, max_retry=15): """Checks the in flight queries on Impala debug page. Polls the state of the query statement from parameter every second until the query gets to a state given via parameter or a maximum retry count is reached. Restriction: Only works if there is only one in flight query.""" impalad_service = ImpaladService(IMPALAD.split(':')[0]) if not impalad_service.wait_for_num_in_flight_queries(1): raise Exception("No in flight query found") retry_count = 0 while retry_count <= max_retry: query_info = impalad_service.get_in_flight_queries()[0] if query_info['stmt'] != stmt: exc_text = "The found in flight query is not the one under test: " + \ query_info['stmt'] raise Exception(exc_text) if query_info['state'] == state: return retry_count += 1 sleep(1.0) raise Exception("Query didn't reach desired state: " + state)
def wait_for_query_state(vector, stmt, state, max_retry=15): """Waits for the given query 'stmt' to reach the given query 'state'. The state of the query is taken from the debug web ui. Polls the state of 'stmt' every second until the query gets to a state given via 'state' or a maximum retry count is reached. Restriction: Only works if there is only one in flight query.""" impalad_service = ImpaladService(get_impalad_host_port(vector).split(':')[0]) if not impalad_service.wait_for_num_in_flight_queries(1): raise Exception("No in flight query found") retry_count = 0 while retry_count <= max_retry: query_info = impalad_service.get_in_flight_queries()[0] print(str(query_info)) if query_info['stmt'] != stmt: exc_text = "The found in flight query is not the one under test: " + \ query_info['stmt'] raise Exception(exc_text) if query_info['state'] == state: return retry_count += 1 time.sleep(1.0) raise Exception("Query didn't reach desired state: " + state)