airflow.providers.amazon.aws.triggers.base
¶
Module Contents¶
Classes¶
Base class for all AWS Triggers that follow the "standard" model of just waiting on a waiter. |
- class airflow.providers.amazon.aws.triggers.base.AwsBaseWaiterTrigger(*, serialized_fields, waiter_name, waiter_args, failure_message, status_message, status_queries, return_key='value', return_value, waiter_delay, waiter_max_attempts, aws_conn_id, region_name=None)[source]¶
Bases:
airflow.triggers.base.BaseTrigger
Base class for all AWS Triggers that follow the “standard” model of just waiting on a waiter.
Subclasses need to implement the hook() method.
- Parameters
serialized_fields (dict[str, Any]) – Fields that are specific to the subclass trigger and need to be serialized to be passed to the __init__ method on deserialization. The conn id, region, and waiter delay & attempts are always serialized. format: {<parameter_name>: <parameter_value>}
waiter_name (str) – The name of the (possibly custom) boto waiter to use.
waiter_args (dict[str, Any]) – The arguments to pass to the waiter.
failure_message (str) – The message to log if a failure state is reached.
status_message (str) – The message logged when printing the status of the service.
status_queries (list[str]) – A list containing the JMESPath queries to retrieve status information from the waiter response. See https://jmespath.org/tutorial.html
return_key (str) – The key to use for the return_value in the TriggerEvent this emits on success. Defaults to “value”.
return_value (Any) – A value that’ll be returned in the return_key field of the TriggerEvent. Set to None if there is nothing to return.
waiter_delay (int) – The amount of time in seconds to wait between attempts.
waiter_max_attempts (int) – The maximum number of attempts to be made.
aws_conn_id (str | None) – The Airflow connection used for AWS credentials. To be used to build the hook.
region_name (str | None) – The AWS region where the resources to watch are. To be used to build the hook.
- async run()[source]¶
Run the trigger in an asynchronous context.
The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.
If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).
In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.