Wait until the query is in a terminal state.
(self, operation_handle, timeout_s=60)
| 1072 | return self.__get_operation(operation_handle).get_status() |
| 1073 | |
| 1074 | def wait_for(self, operation_handle, timeout_s=60): |
| 1075 | """ |
| 1076 | Wait until the query is in a terminal state. |
| 1077 | """ |
| 1078 | start_time = time.time() |
| 1079 | while True: |
| 1080 | operation_state = self.get_state(operation_handle) |
| 1081 | if operation_state not in ("PENDING_STATE", "INITIALIZED_STATE", "RUNNING_STATE"): |
| 1082 | return operation_state |
| 1083 | if time.time() - start_time > timeout_s: |
| 1084 | raise Exception("Timed out waiting for the query") |
| 1085 | time.sleep(0.1) |
| 1086 | |
| 1087 | def cancel(self, operation_handle): |
| 1088 | self.log_handle(operation_handle, "canceling operation") |