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

Fix: make dry run optional for patch task instance #34568

Merged
merged 5 commits into from
Sep 30, 2023

Conversation

Calder-Ty
Copy link
Contributor

Fixes #34563. This sets Dry run to be optional as the docs indicate it should be and makes the default False per the docs.


^ 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.

This fixes an issue where dry_run is not actually and optional parameter
in the patch task_instance api.
@Calder-Ty
Copy link
Contributor Author

This is a reopened version of #34564 which was closed by mistake (by myself).

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Sep 22, 2023
@Calder-Ty
Copy link
Contributor Author

I didn't want this comment to be forgotten:

#34564 (review)

@f0restron07
Copy link

Hi @Calder-Ty,

Thank you for addressing this issue and for reopening the pull request. Making dry_run optional and setting the default to False aligns the behavior of the code with the documentation, which will certainly prevent confusion and errors for API users in the future.

It is crucial that the API's behavior is consistent with the documentation to ensure a smooth and reliable user experience, and this change is a step in the right direction.

Looking at the commits, it seems you have kept the changes concise and directly related to the issue at hand, which is appreciated. It's also good to see that the checks have mostly passed, indicating that this change doesn't introduce any apparent regressions or new issues.

I look forward to seeing this change merged after the required reviews, and I believe it will be a valuable improvement to Apache Airflow.

Thank you again for your contribution!

Best regards,
f0restron

@Calder-Ty Calder-Ty changed the title Fix dry run Fix: make dry run optional for patch task instance Sep 24, 2023
@hussein-awala
Copy link
Member

@pierrejeambrun in the first PR, I commented with:

IMHO it's a problem in the doc, dry_run should be True by default.

WDYT? If you agree, should we fix the doc and the bug in the same PR?

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Sep 24, 2023

Yes, all other dry_run params default to True in other routes, the only 2 that do not in the doc are:

I think defaulting to true makes more sense, and is more conservative, unless explicitly stated by the user with a dry_run=False, we should run in dry run mode.

Also just for a consistency reason, dry_run should be True. Updating the doc and the schema in one place will fix both endpoints mentioned.

Yes this is a very small located change, updating both the schema and the API spec and putting this under bug fix seems fine to me :)

@pierrejeambrun pierrejeambrun added the type:bug-fix Changelog: Bug Fixes label Sep 24, 2023
@pierrejeambrun pierrejeambrun added this to the Airflow 2.7.2 milestone Sep 24, 2023
This updates the docs and the code so that they are in alignment while
also being consistent with all other endpoints. All other Endpoints have
dry run set to be True by default.
@Calder-Ty
Copy link
Contributor Author

made changes to have docs and code aligned, as well as be consistent with the rest of the API (i.e Set dry_run to be true by default,

Copy link
Contributor

@ephraimbuddy ephraimbuddy left a comment

Choose a reason for hiding this comment

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

We should only update here:

to use data.get(‘dry_run’, False)

airflow/api_connexion/openapi/v1.yaml Show resolved Hide resolved
airflow/api_connexion/schemas/task_instance_schema.py Outdated Show resolved Hide resolved
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

LGTM, this is consistent with dry_run default value for other endpoints. (And the more conservative choice, I believe)

Copy link
Contributor

@o-nikolas o-nikolas left a comment

Choose a reason for hiding this comment

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

Other than the static check failures (should be an easy fix to the generated ts) it lgtm.

I like the fix in the schema!

@o-nikolas
Copy link
Contributor

Also, are we considering this change to the default a breaking change to the API or a bugfix?

CC @eladkal

@Calder-Ty
Copy link
Contributor Author

Also, are we considering this change to the default a breaking change to the API or a bugfix?

CC @eladkal

Technically it is, however, I think we can be fairly sure no one was depending on the functionality since it was broken.

@hussein-awala
Copy link
Member

Also, are we considering this change to the default a breaking change to the API or a bugfix?

CC @eladkal

Based on this issue #34563, we cannot use the endpoint without providing the dry_run value, so this PR technically adds a new default value for dry_run and not changing it from False to True.

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Sep 27, 2023

Yep, what Hussein said, not a breaking change. (Field was required before)

@pierrejeambrun pierrejeambrun merged commit a4357ca into apache:main Sep 30, 2023
43 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 30, 2023

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

ephraimbuddy pushed a commit that referenced this pull request Oct 5, 2023
* fix: Make dry_run optional per docs

This fixes an issue where dry_run is not actually and optional parameter
in the patch task_instance api.

* chore: remove formatting changes

* fix: Make changes for api docs

This updates the docs and the code so that they are in alignment while
also being consistent with all other endpoints. All other Endpoints have
dry run set to be True by default.

* fix: Update static ts file for api change

* fix: Remove dump_default

(cherry picked from commit a4357ca)
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 type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DryRun is not optional for patch task instance
6 participants