Repository navigation
DryRun is not optional for patch task instance #34563
Description
Activity
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
Hi,
Thank you for sharing this. It appears there is a mismatch between the API documentation and the actual behavior of the endpoint, which is resulting in a KeyError for the dry_run variable.
Suggested Steps:
Bug Report:
If not already done, consider reporting this as a bug in the official Airflow GitHub repository or check if there is already an existing issue reported for this behavior.Temporary Workaround:
As a temporary workaround, you can include the dry_run variable with a value of false in your API requests to avoid the KeyError, until the issue is fixed in the codebase.Code Modification:
You can also modify the code to handle the absence of the dry_run variable properly, making it optional as per the documentation, and set it to false as the default value if it's not provided in the request.Example Code Modification:
data.get("dry_run", False)
This would access the dry_run value if it exists in the data dictionary and would default to False if it doesn’t exist, avoiding the KeyError.Next Steps:
Await for feedback on the submitted bug report.
Follow the status of the issue and apply the official fix once it’s available in the future release.
In the meantime, it would be helpful to always provide the dry_run variable with your requests as mentioned above.I hope this helps and makes your interaction with Airflow’s REST API smoother.
Best Regards,
f0restron@f0restron07 Please avoid the answers generated with LLM, if you have a valuable comments, don't hesitate to add them, but copying an LLM answer could have a negative impact on communication with users
If not already done, consider reporting this as a bug in the official Airflow GitHub repository or check if there is already an existing issue reported for this behavior.
This issue is what we call bug report :)
Reacted by Niko Oliveira- addedkind:bugThis is a clearly a bugThis is a clearly a bugarea:APIAirflow's REST/HTTP APIAirflow's REST/HTTP API
on Sep 24, 2023
Summary
According to the REST api docs.
you can patch a task instance state. When you hit the api without sending a
"dry_run" variable, you get a KeyError (This is from a server running version 2.5.3):
The API docs state that dry_run is not required and that it is defaulted to false.
This can be reproduced in
mainwith the tests by commenting out line 1699 intest_task_instance_endpoint.py