vincbeck commented on code in PR #46945: URL: https://github.com/apache/airflow/pull/46945#discussion_r1967939710
########## providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py: ########## @@ -0,0 +1,113 @@ +# +# 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 collections.abc import Collection, Sequence +from typing import TYPE_CHECKING + +from airflow.exceptions import AirflowException +from airflow.providers.amazon.aws.hooks.mwaa import MwaaHook +from airflow.providers.amazon.aws.sensors.base_aws import AwsBaseSensor +from airflow.providers.amazon.aws.utils.mixins import aws_template_fields +from airflow.utils.state import State + +if TYPE_CHECKING: + from airflow.utils.context import Context + + +class MwaaDagRunSensor(AwsBaseSensor[MwaaHook]): + """ + Waits for a DAG Run in an MWAA Environment to complete. + + If the DAG Run fails, an AirflowException is thrown. + + .. seealso:: + For more information on how to use this sensor, take a look at the guide: + :ref:`howto/sensor:MwaaDagRunSensor` + + :param external_env_name: The external MWAA environment name that contains the DAG Run you want to wait for + (templated) + :param external_dag_id: The DAG ID in the external MWAA environment that contains the DAG Run you want to wait for + (templated) + :param external_dag_run_id: The DAG Run ID in the external MWAA environment that you want to wait for (templated) + :param success_states: Collection of DAG Run states that would make this task marked as successful, default is + ``airflow.utils.state.State.success_states`` (templated) + :param failure_states: Collection of DAG Run states that would make this task marked as failed and raise an + AirflowException, default is ``airflow.utils.state.State.failed_states`` (templated) + """ + + aws_hook_class = MwaaHook + template_fields: Sequence[str] = aws_template_fields( + "ext_env_name", Review Comment: These fields do not match the parameters -- 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]
