Keeps polling for the query's state using client in the given interval until the query's state reaches the target state or the given timeout has been reached.
(self, client, query_handle, target_state,
timeout=10, interval=1)
| 443 | return status_line.split('Query Status:')[1].strip() |
| 444 | |
| 445 | def wait_for_query_state(self, client, query_handle, target_state, |
| 446 | timeout=10, interval=1): |
| 447 | """Keeps polling for the query's state using client in the given interval until |
| 448 | the query's state reaches the target state or the given timeout has been reached.""" |
| 449 | start_time = time() |
| 450 | while (time() - start_time < timeout): |
| 451 | try: |
| 452 | query_state = client.get_state(query_handle) |
| 453 | except Exception as e: |
| 454 | LOG.error("Exception while getting state of query {0}\n{1}".format( |
| 455 | client.handle_id(query_handle), str(e))) |
| 456 | if query_state == target_state: |
| 457 | return |
| 458 | sleep(interval) |
| 459 | assert target_state == query_state, \ |
| 460 | 'Query {0} did not reach query state in time target={1} actual={2}'.format( |
| 461 | client.handle_id(query_handle), target_state, query_state) |
| 462 | return |
| 463 | |
| 464 | def wait_for_query_status(self, query_id, expected_content, timeout=30, interval=1): |
| 465 | """Polls for the query's status in the query profile web page to contain the |