-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Fix EmrCreateJobFlowOperator
using deferrable mode with wait_for_completion
#41561
base: main
Are you sure you want to change the base?
Fix EmrCreateJobFlowOperator
using deferrable mode with wait_for_completion
#41561
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)
|
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.
Welcome to Apache Airflow and congrats for your first PR!
Good start, I have some comments :)
@@ -824,7 +824,7 @@ def execute(self, context: Context) -> str | None: | |||
job_flow_id=self._job_flow_id, | |||
log_uri=get_log_uri(emr_client=self._emr_hook.conn, job_flow_id=self._job_flow_id), | |||
) | |||
if self.deferrable: | |||
if self.deferrable and self.wait_for_completion: |
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.
- I'd consider refactoring both conditions as follows (a bit more readable IMO):
if self.wait_for_completion:
if self.deferrable:
...
else:
...
- Unit tests + docstring update for this behavior would be helpful.
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.
Is not it the case for 1? But I definitely agree on 2 :)
Thank you for letting me know, @shahar1. I will make the changes and add comments again . I'll update you once the problem is resolved." |
4097299
to
ce5bee1
Compare
@shahar1 sir please review the update. |
Can you please add unit tests? |
@shahar1 sir could you please advise on the appropriate folder for placing unit test cases? |
|
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.
Good job!
Looks great! |
Some tests are failing, could you check that please? |
Hello, here's some guidance:
Also, please notice that you need to resolve conflicts by merging/rebasing from |
Thank you for your help, @shahar1 sir. I’ve resolved the issue, and all checks have now passed on GitHub. I really appreciate your guidance! |
There is a conflict now :) |
EmrCreateJobFlowOperator
using deferrable mode with wait_for_completion
Sir, I resolved the branch conflict. Please review the updates. |
Summary of Changes
This PR addresses issue #40966 by modifying the logic in the
EmrCreateJobFlowOperator
to ensure that thedeferrable
argument only activates the deferral trigger whenwait_for_completion
is also set toTrue
. Previously, the deferral trigger would be added regardless of thewait_for_completion
setting, leading to unintended behavior.Changes Made:
deferrable
andwait_for_completion
.wait_for_completion=True
anddeferrable=False
.Please review the changes, and let me know if further adjustments are needed.
Closes: #40966