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

Deprecate some functions in the experimental API #19931

Merged
merged 13 commits into from
Dec 16, 2021

Conversation

ephraimbuddy
Copy link
Contributor

This PR seeks to deprecate some functions in the experimental API.
Some of the deprecated functions are only used in the experimental REST API,
others that are valid are being moved out of the experimental package.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:core-operators Operators, Sensors and hooks within Core Airflow area:webserver Webserver related Issues labels Dec 1, 2021
@ephraimbuddy ephraimbuddy marked this pull request as ready for review December 1, 2021 17:09
the_pool = pool.get_pool(name=name)
the_pool = Pool.get_pool(pool_name=name)
if not the_pool:
raise PoolNotFound(f"Pool {name} not found")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the get_pool experimental API raises PoolNotFound when the pool does not exist. Since I have moved it to the Pool model, I don't want it to raise hence raising not found here

Copy link
Member

@uranusjr uranusjr Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at where this function is being called, I wonder if we should just get rid of this exception altogether and just return Optional. Not sure about this.

Comment on lines 63 to 66
try:
models_ = [mapper.class_ for mapper in models.base.Base.registry.mappers]
except AttributeError:
models_ = models.base.Base._decl_class_registry.values()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worthwhile to put this somewhere in airflow.utils with a docstring explaining why it’s needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? It was probably a work around for not having SQLA relationships defined.

(I guess we still don't have all of them defined)

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we delete airflow/api/common/experimental/delete_dag.py etc as part of this PR too?

@ephraimbuddy
Copy link
Contributor Author

Shouldn't we delete airflow/api/common/experimental/delete_dag.py etc as part of this PR too?

I was of the opinion that it's a public API and want to deprecate it first and remove it in 2.3.0 but if it's not, I can remove it. Let me know if I should go-ahead

@ashb
Copy link
Member

ashb commented Dec 7, 2021

Shouldn't we delete airflow/api/common/experimental/delete_dag.py etc as part of this PR too?

I was of the opinion that it's a public API and want to deprecate it first and remove it in 2.3.0 but if it's not, I can remove it. Let me know if I should go-ahead

Yes, good point. Use the same approach as I mention here #18724 (comment)

@ephraimbuddy ephraimbuddy force-pushed the deprecate-fns branch 2 times, most recently from 8e10ec5 to e1a38c6 Compare December 7, 2021 20:02
@ephraimbuddy ephraimbuddy requested review from ashb and uranusjr December 8, 2021 18:35
from airflow.api.common.experimental import check_and_get_dag, check_and_get_dagrun


@deprecated(reason="Use DagRun().get_state() instead", version="2.2.3")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still used in airflow/www/api/experimental/endpoints.py -- if we are deprecating it we will need to change those references too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The experimental API is also deprecated: See

def add_deprecation_headers(response: Response):
"""
Add `Deprecation HTTP Header Field
<https://tools.ietf.org/id/draft-dalal-deprecation-header-03.html>`__.
"""
.

My thinking is that if someone is using it externally which may be possible, then we should warn

airflow/models/pool.py Outdated Show resolved Hide resolved
airflow/models/pool.py Outdated Show resolved Hide resolved
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Dec 15, 2021
@ephraimbuddy ephraimbuddy merged commit 6239ae9 into apache:main Dec 16, 2021
@ephraimbuddy ephraimbuddy deleted the deprecate-fns branch December 16, 2021 11:30
@jedcunningham jedcunningham added this to the Airflow 2.2.4 milestone Jan 27, 2022
jedcunningham pushed a commit that referenced this pull request Jan 27, 2022
This PR seeks to deprecate some functions in the experimental API.
Some of the deprecated functions are only used in the experimental REST API,
others that are valid are being moved out of the experimental package.

(cherry picked from commit 6239ae9)
jedcunningham pushed a commit that referenced this pull request Jan 28, 2022
This PR seeks to deprecate some functions in the experimental API.
Some of the deprecated functions are only used in the experimental REST API,
others that are valid are being moved out of the experimental package.

(cherry picked from commit 6239ae9)
jedcunningham pushed a commit that referenced this pull request Feb 17, 2022
This PR seeks to deprecate some functions in the experimental API.
Some of the deprecated functions are only used in the experimental REST API,
others that are valid are being moved out of the experimental package.

(cherry picked from commit 6239ae9)
@jedcunningham jedcunningham added the type:misc/internal Changelog: Misc changes that should appear in change log label Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:core-operators Operators, Sensors and hooks within Core Airflow area:webserver Webserver related Issues full tests needed We need to run full set of tests for this PR to merge type:misc/internal Changelog: Misc changes that should appear in change log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants