Skip to content

Conversation

@sunank200
Copy link
Collaborator

@sunank200 sunank200 commented Feb 21, 2024

This PR is from @uranusjr and it fixes the tests broken in astronomer#1506. The two classes 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.

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

@boring-cyborg boring-cyborg bot added area:CLI area:Scheduler including HA (high availability) scheduler area:serialization labels Feb 21, 2024
@sunank200 sunank200 force-pushed the add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance branch 2 times, most recently from 6ad7bb9 to 4953c87 Compare February 21, 2024 15:13
@dstandish dstandish force-pushed the add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance branch 2 times, most recently from e5594c6 to 76a8923 Compare February 21, 2024 23:23
uranusjr and others added 2 commits February 22, 2024 10:35
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
@sunank200 sunank200 force-pushed the add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance branch from 76a8923 to 355590a Compare February 22, 2024 05:05
@sunank200 sunank200 changed the title Add conditional logic for dataset triggering with refactored dataset inheritance Refactor dataset class inheritance Feb 22, 2024
@sunank200 sunank200 marked this pull request as ready for review February 22, 2024 05:11
@uranusjr
Copy link
Member

I feel we should do this before #37101. There are some parts on that PR (importing from airflow.models, for example) that I feel very wrong to be in main.

@sunank200
Copy link
Collaborator Author

I feel we should do this before #37101. There are some parts on that PR (importing from airflow.models, for example) that I feel very wrong to be in main.

Sure I will merge this before #37101

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
@phanikumv phanikumv merged commit 0900055 into apache:main Feb 22, 2024
@phanikumv phanikumv deleted the add-conditional-logic-for-dataset-triggering-with-refactored-dataset-inheritance branch February 22, 2024 08:59
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>
@ephraimbuddy ephraimbuddy added this to the Airflow 2.9.0 milestone Mar 6, 2024
@ephraimbuddy ephraimbuddy added the type:improvement Changelog: Improvements label Mar 6, 2024
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants