seanghaeli commented on code in PR #51719:
URL: https://github.com/apache/airflow/pull/51719#discussion_r2190625039
##########
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py:
##########
@@ -106,6 +106,87 @@ def hook(self) -> AwsGenericHook:
)
+class MwaaTaskCompletedTrigger(AwsBaseWaiterTrigger):
+ """
+ Trigger when an MWAA Task is complete.
+
+ :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 external_task_id: The Task ID in the external MWAA environment that
you want to wait for (templated)
+ :param success_states: Collection of task instance states that would make
this task marked as successful, default is
+ ``{airflow.utils.state.TaskInstanceState.SUCCESS}`` (templated)
+ :param failure_states: Collection of task instance states that would make
this task marked as failed and raise an
+ AirflowException, default is
``{airflow.utils.state.TaskInstanceState.FAILED}`` (templated)
+ :param waiter_delay: The amount of time in seconds to wait between
attempts. (default: 60)
+ :param waiter_max_attempts: The maximum number of attempts to be made.
(default: 720)
+ :param aws_conn_id: The Airflow connection used for AWS credentials.
+ """
+
+ def __init__(
+ self,
+ *,
+ external_env_name: str,
+ external_dag_id: str,
+ external_dag_run_id: str,
+ external_task_id: str,
+ success_states: Collection[str] | None = None,
+ failure_states: Collection[str] | None = None,
+ waiter_delay: int = 60,
+ waiter_max_attempts: int = 720,
+ aws_conn_id: str | None = None,
+ ) -> None:
+ self.success_states = set(success_states) if success_states else
{TaskInstanceState.SUCCESS.value}
+ self.failure_states = set(failure_states) if failure_states else
{TaskInstanceState.FAILED.value}
+
+ if len(self.success_states & self.failure_states):
+ raise ValueError("success_states and failure_states must not have
any values in common")
+
+ in_progress_states = {s.value for s in TaskInstanceState} -
self.success_states - self.failure_states
Review Comment:
Updated the logic here for review
--
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]