Introducing Logical Operators for dataset conditional logic#37101
Merged
phanikumv merged 13 commits intoapache:mainfrom Feb 26, 2024
Merged
Introducing Logical Operators for dataset conditional logic#37101phanikumv merged 13 commits intoapache:mainfrom
phanikumv merged 13 commits intoapache:mainfrom
Conversation
b4ca8da to
ee9de54
Compare
uranusjr
reviewed
Jan 31, 2024
ee9de54 to
5189828
Compare
c6ce4c7 to
caca0f0
Compare
This was referenced Feb 8, 2024
e95321c to
e64450f
Compare
ef19e0f to
fedc169
Compare
Member
|
As #37016 has been merged, I think we might need to rebase from the main branch and resolve the conflicts before we can review it. |
2440c8c to
428087e
Compare
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
Lee-W
reviewed
Feb 23, 2024
f441e90 to
6b2fdab
Compare
Lee-W
approved these changes
Feb 23, 2024
dstandish
approved these changes
Feb 26, 2024
uranusjr
approved these changes
Feb 26, 2024
Member
uranusjr
left a comment
There was a problem hiding this comment.
I added a commit to put __and__ and __or__ in the base class instead, and add comment on the optimized __and__ and __or__ for clarity to avoid future readers needing to ask #37101 (comment) again.
phanikumv
approved these changes
Feb 26, 2024
alejorodriguez96
pushed a commit
to alejorodriguez96/airflow
that referenced
this pull request
Feb 26, 2024
…7101) * Implement | and & operators so that they can be used instead of DatasetAll and DatasetAny * Refactor dataset class inheritance (apache#37590) * Refactor DatasetAll and DatasetAny inheritance They are moved from airflow.models.datasets to airflow.datasets since the intention is to use them with Dataset, not DatasetModel. It is more natural for users to import from the latter module instead. A new (abstract) base class is added for the two classes, plus the OG Dataset class, to inherit from. This allows us to replace a few isinstance checks with simple molymorphism and make the logic a bit simpler. Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com> Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
alejorodriguez96
pushed a commit
to alejorodriguez96/airflow
that referenced
this pull request
Feb 26, 2024
…7101) * Implement | and & operators so that they can be used instead of DatasetAll and DatasetAny * Refactor dataset class inheritance (apache#37590) * Refactor DatasetAll and DatasetAny inheritance They are moved from airflow.models.datasets to airflow.datasets since the intention is to use them with Dataset, not DatasetModel. It is more natural for users to import from the latter module instead. A new (abstract) base class is added for the two classes, plus the OG Dataset class, to inherit from. This allows us to replace a few isinstance checks with simple molymorphism and make the logic a bit simpler. Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com> Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2 tasks
dstandish
reviewed
Feb 29, 2024
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've expanded the dataset dependency handling in Airflow, building on PR #37016. This PR introduces the use of logical operators (
|for OR and&for AND) to linkDatasetinstances, simplifying the expression of complex dependencies.Key Enhancements:
|and&for combiningDatasetobjects.Datasetclass.DatasetAnyandDatasetAllclasses for OR/AND conditions.DatasetsExpressionclass for building dataset condition trees.extract_datasetsfunction to interpret these expression trees.Example:
This update offers a more intuitive way of expressing dataset dependencies in Airflow workflows.
Depends on the merge of PR #37016.
Dependency Checklist
^ 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.