Uh oh!
There was an error while loading. Please reload this page.
Fix RedshiftDataOperator not running in deferred mode when it should - #41206
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
eladkal
commented
Aug 2, 2024
Wasn't this already fixed in #41191 ? |
At first I thought too, but it's a different |
eladkal
commented
Aug 2, 2024
Ah OK. |
vincbeck
left a comment
There was a problem hiding this comment.
Agree with Elad, a unit test would be great, but otherwise LGTM
borismo
commented
Aug 3, 2024
Here's what I did:
Not sure if it's a good idea to iterate over Warning I realize now that this fix will change the operator's behavior: for folks who have been using it with |
vincbeck
commented
Aug 6, 2024
You are correct but this is a bug fix. The previous behavior was wrong so to me we should go ahead with that change |
eladkal
commented
Aug 6, 2024
Can you add to the provider changelog a block of to the changelog where you explain how to mitigate the change. It needs to have 2-4 sentenses that just users would understand what was change and how to mitigate this. Example: https://github.com/apache/airflow/blob/main/airflow/providers/amazon/CHANGELOG.rst#870 |
Uh oh!
There was an error while loading. Please reload this page.
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Problems
RedshiftDataOperatortask is configured withdeferrable=Trueandwait_for_completion=True(the default), it doesn't go indeferredstate. Instead it stays inrunningstate until the statement completes.wait_for_completion=Falseanddeferrable=True, after the statement is submitted, the task will still go intodeferredmode and wait for the statement to complete.Reasons
deferrable=True,self.wait_for_completionis set toFalseinexecute(), but never used after.executedoes not check whether the task should wait for completion, only if it should be deferred.Solution
wait_for_completioninstead ofself.wait_for_completionwhen deferrable. Also, remove redundant condition onself.wait_for_completionHow I tested
Checked with this simple DAG that the operator now behaves as expected, for all 4 combinations:
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.