syedahsn commented on code in PR #31657: URL: https://github.com/apache/airflow/pull/31657#discussion_r1228706671
########## airflow/providers/amazon/aws/triggers/eks.py: ########## @@ -0,0 +1,178 @@ +# 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 asyncio +from functools import cached_property +from typing import Any + +from botocore.exceptions import WaiterError + +from airflow.providers.amazon.aws.hooks.eks import EksHook +from airflow.triggers.base import BaseTrigger, TriggerEvent + + +class EksCreateFargateProfileTrigger(BaseTrigger): + """ + Trigger for EksCreateFargateProfileOperator. + The trigger will asynchronously wait for the fargate profile to be created. + + :param cluster_name: The name of the EKS cluster + :param fargate_profile_name: The name of the fargate profile + :param poll_interval: The amount of time in seconds to wait between attempts. + :param max_attempts: The maximum number of attempts to be made. + :param aws_conn_id: The Airflow connection used for AWS credentials. + """ + + def __init__( + self, + cluster_name: str, + fargate_profile_name: str, + poll_interval: int, + max_attempts: int, + aws_conn_id: str, + ): + self.cluster_name = cluster_name + self.fargate_profile_name = fargate_profile_name + self.poll_interval = poll_interval + self.max_attempts = max_attempts + self.aws_conn_id = aws_conn_id + + def serialize(self) -> tuple[str, dict[str, Any]]: + return ( + self.__class__.__module__ + "." + self.__class__.__qualname__, Review Comment: This is an improvement to what we were initially doing, which was a hard coded string with the trigger path. As for making it a separate function, I'm open to it if others feel it necessary, but considering its a one line function, I don't feel like its worth it. But I'm not opposed to it either. -- 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]
