Fix RedshiftDataOperator not running in deferred mode when it should#41206
Fix RedshiftDataOperator not running in deferred mode when it should#41206eladkal merged 9 commits intoapache:mainfrom borismo:main
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)
|
|
Wasn't this already fixed in #41191 ? |
|
At first I thought too, but it's a different |
|
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
|
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 |
You are correct but this is a bug fix. The previous behavior was wrong so to me we should go ahead with that change |
|
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 |
|
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.