Wait until 'cursor' is in a CANCELED or ERROR status.
(self, cursor, query_id)
| 243 | secs_since_log += sleep_secs |
| 244 | |
| 245 | def _wait_until_cancelled(self, cursor, query_id): |
| 246 | """Wait until 'cursor' is in a CANCELED or ERROR status.""" |
| 247 | last_log_time = 0 |
| 248 | status = cursor.status() |
| 249 | while status not in ["CANCELED_STATE", "ERROR_STATE"]: |
| 250 | # Work around IMPALA-7561: queries don't transition out of FINISHED state once they |
| 251 | # hit eos. |
| 252 | if status == "FINISHED_STATE" and "Last row fetched" in cursor.get_profile(): |
| 253 | return |
| 254 | if time() - last_log_time > 5: |
| 255 | LOG.debug("Waiting for query with id {query_id} to be cancelled".format( |
| 256 | query_id=query_id)) |
| 257 | last_log_time = time() |
| 258 | sleep(0.1) |
| 259 | status = cursor.status() |
| 260 | |
| 261 | def update_from_query_report(self, report): |
| 262 | LOG.debug("Updating runtime stats (Query Runner PID: {0})".format(self.proc.pid)) |