-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Refactor dataset class inheritance #37590
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
Merged
phanikumv
merged 4 commits into
apache:main
from
astronomer:add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance
Feb 22, 2024
Merged
Refactor dataset class inheritance #37590
phanikumv
merged 4 commits into
apache:main
from
astronomer:add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance
Feb 22, 2024
Conversation
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
6ad7bb9 to
4953c87
Compare
e5594c6 to
76a8923
Compare
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.
Fix the import paths and static check errors
76a8923 to
355590a
Compare
Member
|
I feel we should do this before #37101. There are some parts on that PR (importing from |
Lee-W
reviewed
Feb 22, 2024
Collaborator
Author
Co-authored-by: Wei Lee <weilee.rx@gmail.com>
uranusjr
reviewed
Feb 22, 2024
uranusjr
approved these changes
Feb 22, 2024
Lee-W
approved these changes
Feb 22, 2024
sunank200
added a commit
to astronomer/airflow
that referenced
this pull request
Feb 22, 2024
* 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>
sudiptob2
pushed a commit
to Satoshi-Sh/airflow
that referenced
this pull request
Feb 22, 2024
* 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>
phanikumv
pushed a commit
that referenced
this pull request
Feb 26, 2024
* Implement | and & operators so that they can be used instead of DatasetAll and DatasetAny * Refactor dataset class inheritance (#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>
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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:CLI
area:Scheduler
including HA (high availability) scheduler
area:serialization
type:improvement
Changelog: Improvements
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.
This PR is from @uranusjr and it fixes the tests broken in astronomer#1506. The two classes are moved from
airflow.models.datasetstoairflow.datasetssince 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.
Some minor changes are required to satisfy the linter.
^ 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.