-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add MwaaTaskSensor to Amazon Provider Package #51719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
Outdated
Show resolved
Hide resolved
Wouldn't it still wait for the dag run to complete? I think in this case the waiting would always be in deferrable mode instead of using the config value for If we want to test the sensor during execution, we could run the dag again in another task before the sensor task but I'm not sure if we want to be that exhaustive in system tests |
@ramitkataria With |
Also discussed offline but in short, the sensor task would still wait for this task because the sensor task is set to depend on this task since they're in a chain |
… adjust the default value of in base class to . - Add defensive test around adding more task instance states to keep of the MwaaTaskCompletedTrigger up to date. - Fix issue where of the MwaaTaskSensor derives to instead of type. - Modify documentation to clearly indicate that the MwaaTaskSensor is meant to sense tasks across different MWAA environments. - Make an optional parameter, where it defaults to the latest dag run. - Externally fetch the task ID variable. - Test the sensor while a DAG Run is still in progress.
|
I see that the commit message is rendering weird above so I'll rewrite it here for clarity:
|
providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
Outdated
Show resolved
Hide resolved
- Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding.
|
The two threads still in need of confirmation are: #51719 (comment) and #51719 (comment) |
- Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding.
- Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding.
- Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding.
|
Bad rebase @seanghaeli I think. You might want to undo it |
5b03461 to
a9fcc58
Compare
Thanks good point. Reverted but can't untag the extra reviewers it pinged. Sorry all! |
providers/amazon/src/airflow/providers/amazon/aws/sensors/mwaa.py
Outdated
Show resolved
Hide resolved
vincbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some mypy failures to take care of though
* Add MwaaTaskSensor to Amazon Provider Package * include pre-commit hooks * - Comply with PR apache#51196: explicitly pass to its superclass, and adjust the default value of in base class to . - Add defensive test around adding more task instance states to keep of the MwaaTaskCompletedTrigger up to date. - Fix issue where of the MwaaTaskSensor derives to instead of type. - Modify documentation to clearly indicate that the MwaaTaskSensor is meant to sense tasks across different MWAA environments. - Make an optional parameter, where it defaults to the latest dag run. - Externally fetch the task ID variable. - Test the sensor while a DAG Run is still in progress. * documentation update * Response to PR apache#51719 comments - Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding. * update tests * Remove duplicate pointer to mwaatasksensor docs * merge apache#53000 * Fix integration tests * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * remove State file from PR * Remove hard coding deferrable property * Remove unnecessary execute_complete function in sensor and instead use end_from_trigger * Correctly use end_from_trigger attribute * Correctly use end_from_trigger attibute for both dag run sensor and task sensor * Remove unnecessary import
* Add MwaaTaskSensor to Amazon Provider Package * include pre-commit hooks * - Comply with PR apache#51196: explicitly pass to its superclass, and adjust the default value of in base class to . - Add defensive test around adding more task instance states to keep of the MwaaTaskCompletedTrigger up to date. - Fix issue where of the MwaaTaskSensor derives to instead of type. - Modify documentation to clearly indicate that the MwaaTaskSensor is meant to sense tasks across different MWAA environments. - Make an optional parameter, where it defaults to the latest dag run. - Externally fetch the task ID variable. - Test the sensor while a DAG Run is still in progress. * documentation update * Response to PR apache#51719 comments - Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding. * update tests * Remove duplicate pointer to mwaatasksensor docs * merge apache#53000 * Fix integration tests * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * remove State file from PR * Remove hard coding deferrable property * Remove unnecessary execute_complete function in sensor and instead use end_from_trigger * Correctly use end_from_trigger attribute * Correctly use end_from_trigger attibute for both dag run sensor and task sensor * Remove unnecessary import
* Add MwaaTaskSensor to Amazon Provider Package * include pre-commit hooks * - Comply with PR apache#51196: explicitly pass to its superclass, and adjust the default value of in base class to . - Add defensive test around adding more task instance states to keep of the MwaaTaskCompletedTrigger up to date. - Fix issue where of the MwaaTaskSensor derives to instead of type. - Modify documentation to clearly indicate that the MwaaTaskSensor is meant to sense tasks across different MWAA environments. - Make an optional parameter, where it defaults to the latest dag run. - Externally fetch the task ID variable. - Test the sensor while a DAG Run is still in progress. * documentation update * Response to PR apache#51719 comments - Brought UPSTREAM_FAILED to a Terminal Task Instance State instead of an Intermediate State. - Added REMOVED to the list of successful terminal task instance states. - Iterate programmatically through successful, failure, and in progress states instead of hard-coding. * update tests * Remove duplicate pointer to mwaatasksensor docs * merge apache#53000 * Fix integration tests * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * removed unnecessary defensive tests for trigger acceptor states after apache#53000 merge * remove State file from PR * Remove hard coding deferrable property * Remove unnecessary execute_complete function in sensor and instead use end_from_trigger * Correctly use end_from_trigger attribute * Correctly use end_from_trigger attibute for both dag run sensor and task sensor * Remove unnecessary import
The
MwaaTaskSensorwaits for the completion of a DAG task instance in an MWAA environment. This PR includes an implementation with unit tests, system tests, and docs. Similar to MwaaDagRunSensorAlso modified system test to have
MwaaTriggerDagRunOperatorset todeferrable=True. This tests theMwaaTaskSensorandMwaaDagRunSensorsensors during execution of DAG Run rather than only afterwards.