-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[API] can return the specified field when get dag/dagRun #36641
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Indeed that nicely solves the most pressing need of partial retrieval of the DAG / DAGRun.
Can you please add some tests covering this ?
@potiuk Hi! Since I am new to airflow, could you please tell me in a nutshell how the test code works? Does my PR just need to add tests code in Do I need to test anything specifically? such as each field be returned correctly? |
Yes. You should add code there just a few examples testing what happens when you run API call with and without field specieifcation - ideally look at other test cases and write similar tests, this is the easiest way to get started with your tests. Your tests should add a few asserts - that the fields are there when expected and that they aren't there when not expected. Generally the tests will be executed automatically in CI and all the tests of ours are easily runnable locally. We have various kinds of tests, but the API tests are just standard unit tests and you have all the docs about running tests - both in local venv, IDE and also in We have also a more generic CONTRIBUTING information https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst how to setup your environment and you will even find QUICK_START quides there specific for popular IDES. |
@potiuk Hi! I have added some tests to cover this |
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
relate to #29893
Hard to add generic retrieve capability to all
get
endpoints, so this PR is just add this capability in dag/dag_detail and dagRunsget
endpoints, which I think need this capability most.For example, if call
https://airflow.apache.org/api/v1/dags?fields=dag_id,is_paused
API, it returns JSON body contains only {dag_id, is_paused} fields.