liferoad commented on code in PR #32967:
URL: https://github.com/apache/beam/pull/32967#discussion_r1821381901


##########
sdks/python/apache_beam/io/gcp/bigquery_tools.py:
##########
@@ -558,6 +559,19 @@ def _insert_load_job(
         ))
     return self._start_job(request, stream=source_stream).jobReference
 
+  @staticmethod
+  def _parse_location_from_exc(content, job_id):
+    """Parse job location from Exception content."""
+    if isinstance(content, bytes):
+      content = content.decode('ascii', 'replace')
+      # search for "Already Exists: Job <project-id>:<location>.<job id>"
+      m = re.search(r"Already Exists: Job \S+\:(\S+)\." + job_id, content)
+      if not m:
+        _LOGGER.warning(
+            "Not able to parse BigQuery load job location for {}", job_id)
+        return None
+      return m.group(1)

Review Comment:
   can we also return None when if instance is not true and log the message?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to