Skip to content

Conversation

@xgao1023
Copy link
Contributor


This is picking up the work from #28183. But do not silently slugify the IDs

@boring-cyborg boring-cyborg bot added area:serialization area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Jul 11, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Jul 11, 2023

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)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@uranusjr
Copy link
Member

Please set up pre-commit locally and fix the static check errors. See guide here: https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#pre-commit-hooks

@bbovenzi
Copy link
Contributor

Could you add an example dag so that we can test it out?

@xgao1023
Copy link
Contributor Author

xgao1023 commented Jul 28, 2023

Could you add an example dag so that we can test it out?

Added

@xgao1023 xgao1023 closed this Jul 28, 2023
@xgao1023 xgao1023 reopened this Jul 28, 2023
@uranusjr
Copy link
Member

Do we also want a unit test? (Open question; there’s not much to be tested tbh, most things are just declarative.)

@xgao1023
Copy link
Contributor Author

xgao1023 commented Jul 28, 2023

Seems that have display_name a read-only property breaking some ORM code

https://github.com/apache/airflow/actions/runs/5687937364/job/15417962420?pr=32520

@uranusjr
Copy link
Member

Looks like display_name is already taken by multiple providers. We should probably come up with something else… Maybe task_display_name?

@xgao1023
Copy link
Contributor Author

Looks like display_name is already taken by multiple providers. We should probably come up with something else… Maybe task_display_name?

Yeah probably. And dag_display_name in DAG?

@uranusjr
Copy link
Member

Sounds right to me

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

I really like this approach, LGTM!

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

I did a deployment and faced a couple of "glitches". Can you check and rework on these? Otherwise as expressed in the comments I really like the feature and would like to have this merged ASAP!

  1. I see many screens, w.g. Grid view not picking up the cool display names. I asuspect a bit of rework in the UI is needed. Low hanging fruit would be the DAG page header - if you could add using display name there would be great.
  2. Starting the system with breeze raised an import error with two examples. Must be fixed, otherwise I assume also a lot of DAGs "in the wild" will fail in there
  3. Two example DAGs are showing import errors when starting the system, probably the same root cause: "error DAG Import Errors (2)"

Error trace for 2)

ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/airflow/example_dags/example_dynamic_task_mapping.py
Traceback (most recent call last):
  File "/opt/airflow/airflow/models/dagbag.py", line 345, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/airflow/airflow/example_dags/example_dynamic_task_mapping.py", line 37, in <module>
    added_values = add_one.expand(x=[1, 2, 3])
  File "/opt/airflow/airflow/decorators/base.py", line 410, in expand
    return self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
  File "/opt/airflow/airflow/decorators/base.py", line 478, in _expand
    operator = _MappedOperator(
TypeError: __init__() missing 1 required keyword-only argument: 'task_display_name'
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/airflow/example_dags/example_params_trigger_ui.py
Traceback (most recent call last):
  File "/opt/airflow/airflow/models/dagbag.py", line 345, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/airflow/airflow/example_dags/example_params_trigger_ui.py", line 103, in <module>
    english_greetings = generate_english_greeting.expand(name=names)
  File "/opt/airflow/airflow/decorators/base.py", line 410, in expand
    return self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
  File "/opt/airflow/airflow/decorators/base.py", line 478, in _expand
    operator = _MappedOperator(
TypeError: __init__() missing 1 required keyword-only argument: 'task_display_name'
Database migrating done!

Error trace for 3)

error DAG Import Errors (2) expand_less
expand_moreBroken DAG: [/opt/airflow/airflow/example_dags/example_dynamic_task_mapping.py] Traceback (most recent call last):
  File "/opt/airflow/airflow/decorators/base.py", line 410, in expand
    return self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
  File "/opt/airflow/airflow/decorators/base.py", line 478, in _expand
    operator = _MappedOperator(
TypeError: __init__() missing 1 required keyword-only argument: 'task_display_name'
expand_moreBroken DAG: [/opt/airflow/airflow/example_dags/example_params_trigger_ui.py] Traceback (most recent call last):
  File "/opt/airflow/airflow/decorators/base.py", line 410, in expand
    return self._expand(DictOfListsExpandInput(map_kwargs), strict=False)
  File "/opt/airflow/airflow/decorators/base.py", line 478, in _expand
    operator = _MappedOperator(
TypeError: __init__() missing 1 required keyword-only argument: 'task_display_name'
DAGs

@uranusjr
Copy link
Member

uranusjr commented Oct 3, 2023

I tried to add a commit to address the error mentioned above, but there are multiple linting errors here and a merge conflict that must be fixed first.

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.

I think you also want to update the react part (Grid, Cluster Activity, Dataset) to use this new display_name instead of the current task_id, dag_id

@xgao1023
Copy link
Contributor Author

xgao1023 commented Oct 30, 2023

I'm resuming working on this - fix the issues and also change UI part.

@eladkal eladkal added this to the Airflow 2.8.0 milestone Oct 30, 2023
@eladkal eladkal added the type:new-feature Changelog: New Features label Oct 30, 2023
@xgao1023
Copy link
Contributor Author

xgao1023 commented Nov 7, 2023

I tried to add a commit to address the error mentioned above, but there are multiple linting errors here and a merge conflict that must be fixed first.

I resolved the conflicts and rebased the branch

@xgao1023
Copy link
Contributor Author

xgao1023 commented Nov 7, 2023

I think you also want to update the react part (Grid, Cluster Activity, Dataset) to use this new display_name instead of the current task_id, dag_id

I will try on this but I’m surely not a frontend expert.

@xgao1023 xgao1023 requested a review from potiuk as a code owner November 8, 2023 03:02
@pierrejeambrun
Copy link
Member

pierrejeambrun commented Dec 17, 2023

I will try on this but I’m surely not a frontend expert.

No worries, try your best. If you feel like this is too much, I think we can do that in follow up PRs, step by step.

cc: @bbovenzi

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

I really like this PR and am looking forward getting this merged. I feel like there are probably another 100 places where the DAG would benefit from displaying the "display name" and not the ID. Might be able to have this updated in the UI incrementally as well to get this merged.

Can you fix-up the DB migration (I hope I understood the alembic tooling right, with the commented fixes it was working for a local test - I hope you don't need to fully re-generate

@xgao1023
Copy link
Contributor Author

xgao1023 commented Feb 1, 2024

I tried to add a commit to address the error mentioned above, but there are multiple linting errors here and a merge conflict that must be fixed first.

@uranusjr
I was trying to fix all errors but I stuck on one thing:

In general the fields on BaseOperator cannot be mapped. But it would be very useful if the display name of each mapped tasks instance can be different according to the expand argument.

Can you give me some hints on how to achieve this?

xgao1023 and others added 2 commits February 5, 2024 16:31
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Aleksandr Shelukheev <shelukheev@gmail.com>
@jscheffl
Copy link
Contributor

I'd really love to have this in - 2.9.0 release cut is across the corner - possible to get the conflicts resolved, the final bug fixed and have this merged?

@uranusjr
Copy link
Member

Hopefully I can spend some time on this maybe next week.

@jscheffl
Copy link
Contributor

As linked in #38446 - I tried to spend time on the weekend to continue working on this PR... let's see if we can get this reviewed and completed...

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.

Nit

Comment on lines +174 to +175
else:
return self.node_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
else:
return self.node_id
return self.node_id

@ephraimbuddy ephraimbuddy removed this from the Airflow 2.9.0 milestone Mar 25, 2024
@kaxil kaxil added this to the Airflow 2.10.0 milestone Mar 27, 2024
@jscheffl
Copy link
Contributor

Closing this PR as completed with #38446 - thanks for the contribution on this branch which was the base for the efforts to make it in (hopefully, if all runs fine) Airflow 2.9.0!

@jscheffl jscheffl closed this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:serialization area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues type:new-feature Changelog: New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants