pankajastro commented on code in PR #30948:
URL: https://github.com/apache/airflow/pull/30948#discussion_r1181055003


##########
airflow/providers/amazon/aws/triggers/glue_crawler.py:
##########
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from airflow.compat.functools import cached_property
+from airflow.providers.amazon.aws.hooks.glue_crawler import GlueCrawlerHook
+from airflow.triggers.base import BaseTrigger, TriggerEvent
+
+
+class GlueCrawlerCompleteTrigger(BaseTrigger):
+    """
+    Watches for a glue crawl, triggers when it finishes
+
+    :param crawler_name: name of the crawler to watch
+    :param poll_interval: The amount of time in seconds to wait between 
attempts.
+    :param max_attempt: The maximum number of attempts to be made.
+    :param conn_id: The Airflow connection used for AWS credentials.
+    """
+
+    def __init__(self, crawler_name: str, poll_interval: int, conn_id: str):
+        super().__init__()
+        self.crawler_name = crawler_name
+        self.poll_interval = poll_interval
+        self.aws_conn_id = conn_id
+
+    def serialize(self) -> tuple[str, dict]:
+        return (
+            self.__class__.__qualname__,

Review Comment:
   does `__qualname__` contents module path also?



##########
tests/providers/amazon/aws/triggers/test_glue.py:
##########
@@ -0,0 +1,69 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import pytest
+from asynctest import MagicMock, mock
+
+from airflow import AirflowException
+from airflow.providers.amazon.aws.hooks.glue import GlueJobHook
+from airflow.providers.amazon.aws.triggers.glue import GlueJobCompleteTrigger
+
+
[email protected]
[email protected](GlueJobHook, "async_get_job_state")
+async def test_wait_job(get_state_mock: MagicMock):

Review Comment:
   can we wrap these tests in class since most of the provider tests including 
Amazon provider tests are class-based also tests would be more readable if we 
add tests for more glue triggers in this file in future.



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