Skip to content

Commit

Permalink
Fix bug in job stats
Browse files Browse the repository at this point in the history
  • Loading branch information
masterlittle committed Apr 12, 2023
1 parent 60e9ab6 commit 67f5642
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion redash/query_runner/big_query.py
Expand Up @@ -101,7 +101,11 @@ def _get_total_bytes_processed_for_resp(bq_response):

def _get_total_slots_for_resp(bq_response):
if "endTime" in bq_response:
return int(bq_response.get("totalSlotMs")) / (int(bq_response.get("finalExecutionDurationMs")))
if bq_response.get("finalExecutionDurationMs"):
duration = int(bq_response.get("finalExecutionDurationMs"))
else:
duration = int(bq_response.get("endTime")) - int(bq_response.get("startTime"))
return int(bq_response.get("totalSlotMs")) / duration
else:
return 0

Expand Down Expand Up @@ -374,6 +378,7 @@ def _check_for_policy_tags_in_query(self, policy_tags_accessed, user):
else:
return ' |\n'.join(
[f"Policy tag- {k}, Sensitive columns accessed- {v}" for k, v in policy_tags_accessed.items()])
return ""

def _update_query_policy_tags(self, policy_tags_accessed, query):
query_hash = self.gen_query_hash(query)
Expand Down

0 comments on commit 67f5642

Please sign in to comment.