bahram-cdt commented on code in PR #62016:
URL: https://github.com/apache/airflow/pull/62016#discussion_r2813945059


##########
providers/amazon/src/airflow/providers/amazon/aws/operators/glue_crawler.py:
##########
@@ -90,12 +100,37 @@ def execute(self, context: Context) -> str:
         """
         crawler_name = self.config["Name"]
         if self.hook.has_crawler(crawler_name):
-            self.hook.update_crawler(**self.config)
+            try:
+                self.hook.update_crawler(**self.config)
+            except ClientError as e:
+                if e.response["Error"]["Code"] == "CrawlerRunningException":
+                    if self.fail_on_already_running:
+                        raise
+                    self.log.warning(
+                        "Crawler '%s' is currently running. "
+                        "Skipping update and waiting for the existing run to 
complete.",
+                        crawler_name,
+                    )
+                else:
+                    raise
         else:
             self.hook.create_crawler(**self.config)
 
         self.log.info("Triggering AWS Glue Crawler")
-        self.hook.start_crawler(crawler_name)
+        try:
+            self.hook.start_crawler(crawler_name)
+        except ClientError as e:
+            if e.response["Error"]["Code"] == "CrawlerRunningException":

Review Comment:
   Thanks for the suggestion. Pushed the changes



-- 
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