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

Get DAG tasks in REST API does not include is_mapped #23284

Closed
1 of 2 tasks
bbovenzi opened this issue Apr 27, 2022 · 3 comments · Fixed by #23319
Closed
1 of 2 tasks

Get DAG tasks in REST API does not include is_mapped #23284

bbovenzi opened this issue Apr 27, 2022 · 3 comments · Fixed by #23319
Assignees
Labels
area:API Airflow's REST/HTTP API area:dynamic-task-mapping AIP-42 kind:bug This is a clearly a bug

Comments

@bbovenzi
Copy link
Contributor

Apache Airflow version

2.3.0b1 (pre-release)

What happened

The rest API endpoint for get /dags/{dag_id}/tasks does not include is_mapped.

Example: consumer is mapped but I have no way to tell that from the API response:
Screen Shot 2022-04-27 at 11 35 54 AM
Screen Shot 2022-04-27 at 11 35 25 AM

What you think should happen instead

Someone should be able to know if a task from get /tasks is mapped or not.

How to reproduce

call get /tasks on a dag with mapped tasks. see there is no way to determine if it is mapped from the response body.

Operating System

Mac OSX

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@bbovenzi bbovenzi added kind:bug This is a clearly a bug area:API Airflow's REST/HTTP API area:dynamic-task-mapping AIP-42 labels Apr 27, 2022
@tirkarthi
Copy link
Contributor

is_mapped field can be added to the TaskSchema that can return it in response. I can work on a PR if the issue is accepted.

diff --git a/airflow/api_connexion/schemas/task_schema.py b/airflow/api_connexion/schemas/task_schema.py
index 600d28ac0..aa9a47030 100644
--- a/airflow/api_connexion/schemas/task_schema.py
+++ b/airflow/api_connexion/schemas/task_schema.py
@@ -58,6 +58,7 @@ class TaskSchema(Schema):
     sub_dag = fields.Nested(DAGSchema, dump_only=True)
     downstream_task_ids = fields.List(fields.String(), dump_only=True)
     params = fields.Method('get_params', dump_only=True)
+    is_mapped = fields.Boolean(dump_only=True)
 
     def _get_class_reference(self, obj):
         result = ClassReferenceSchema().dump(obj)

@bbovenzi
Copy link
Contributor Author

@tirkarthi I say go for it!

@tirkarthi
Copy link
Contributor

Thanks @bbovenzi , created #23319

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:dynamic-task-mapping AIP-42 kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants