Skip to content
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

added difference between Deferrable and Non-Deferrable Operators #31840

Merged
merged 10 commits into from Jun 24, 2023

Conversation

rohan472000
Copy link
Contributor

@rohan472000 rohan472000 commented Jun 11, 2023

closes: #31819


^ 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.rst or {issue_number}.significant.rst, in newsfragments.

@potiuk
Copy link
Member

potiuk commented Jun 11, 2023

Isn't that the same as described at the top? Maybe just adding the header of your above the two paragraphs is enough?

Standard :doc:Operators </core-concepts/operators> and :doc:Sensors <../core-concepts/sensors> take up a full worker slot for the entire time they are running, even if they are idle; for example, if you only have 100 worker slots available to run Tasks, and you have 100 DAGs waiting on a Sensor that's currently running but idle, then you cannot run anything else - even though your entire Airflow cluster is essentially idle. reschedule mode for Sensors solves some of this, allowing Sensors to only run at fixed intervals, but it is inflexible and only allows using time as the reason to resume, not anything else.

This is where Deferrable Operators come in. A deferrable operator is one that is written with the ability to suspend itself and free up the worker when it knows it has to wait, and hand off the job of resuming it to something called a Trigger. As a result, while it is suspended (deferred), it is not taking up a worker slot and your cluster will have a lot less resources wasted on idle Operators or Sensors.

@potiuk
Copy link
Member

potiuk commented Jun 11, 2023

(and maybe cleaning/clarifiying those two chapters that already exist if you feel like they are not clear enough - but I have a feeling that adding yet another description of what defferrable vs. non-deferrable is not necessary. better to improve the existing one).

@utkarsharma2
Copy link
Contributor

cc: @phanikumv

@rohan472000
Copy link
Contributor Author

@uranusjr , plz check my latest push.

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@rohan472000 rohan472000 requested a review from potiuk June 24, 2023 15:05
@potiuk
Copy link
Member

potiuk commented Jun 24, 2023

LGTM.

@potiuk potiuk merged commit 0db0ff1 into apache:main Jun 24, 2023
42 checks passed
@raphaelauv
Copy link
Contributor

raphaelauv commented Jun 26, 2023

+--------------------------------------------------------+--------------------------------------------------------+
| Resource Usage is Higher (repeated execution)          |  Resource Usage is Lower (pauses when idle, frees      |
|                                                        |  up worker slots)                                      |

the reschedule mode also frees up worker slot will it is in UP_FOR_RESCHEDULE

ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 27, 2023
…che#31840)



---------

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@ephraimbuddy ephraimbuddy added the type:doc-only Changelog: Doc Only label Jul 6, 2023
@ephraimbuddy ephraimbuddy added this to the Airlfow 2.6.3 milestone Jul 6, 2023
ephraimbuddy pushed a commit that referenced this pull request Jul 6, 2023
)

---------

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit 0db0ff1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the docs around deferrable mode for Sensors
8 participants