Skip to content

Conversation

@bbovenzi
Copy link
Contributor

@bbovenzi bbovenzi commented Feb 8, 2023

Embed the graph view inside of the grid view so a user can see history and dependencies at the same time.

Closes: #19939

Screenshot 2023-02-07 at 7 05 31 PM

Task Groups:
Screenshot 2023-02-07 at 7 07 44 PM

A complex DAG:
Screenshot 2023-02-07 at 7 04 41 PM

Dynamic task groups:
Screenshot 2023-02-07 at 7 08 51 PM

Edge labels:
Screenshot 2023-02-07 at 7 10 35 PM

Allows users to quickly clear a task group. Closes: #29380

The current graph is built off of dagre-d3 which has been deprecated for quite some time now. So in one way or another we had to update the graph.

Follow up PRs:

  • Once we are confident this new graph is feature complete, delete the old graph and redirect to this one
  • Update Dataset Dependencies to use the same components
  • Move Task Actions out of the details tab, turn it into a modal, and have it accessible within the graph and logs tabs (and including filtering both up and down streams)
  • Animate task group expand/collapse

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

@bbovenzi bbovenzi added this to the Airflow 2.6.0 milestone Feb 8, 2023
@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Feb 8, 2023
@bbovenzi bbovenzi changed the title Add a new graph view inside of the grid view Add a new graph inside of the grid view Feb 8, 2023
@notatallshaw-gts
Copy link
Contributor

notatallshaw-gts commented Feb 8, 2023

Looks great! I'm sure you've already thought of these use cases but just in case two things I'd be worried about with this style of straight lines is:

  1. How it looks when a task has a large number of downstream tasks (e.g. 20+)?
  2. Is it possible to visually distinguish lines when they have to cross each other?

The current curve lines means even though it's messy the angle of lines means it's almost always possible to unambiguously follow them, e.g.:

import datetime
from airflow.models import DAG
from airflow.operators.empty import EmptyOperator


with DAG(
    dag_id="test",
    schedule_interval="@once",
    start_date=datetime.datetime(2000, 1, 1),
) as test:
    upstream_tasks = [EmptyOperator(task_id=f"upstream_{i}") for i in range(4)]
    downstream_tasks = [EmptyOperator(task_id=f"downstream_{i}") for i in range(4)]
    for upstream_task in upstream_tasks:
        upstream_task >> downstream_tasks

    other_tasks = [EmptyOperator(task_id=f"other_{i}") for i in range(16)]
    upstream_tasks[0] >> other_tasks

@bbovenzi
Copy link
Contributor Author

bbovenzi commented Feb 8, 2023

Here's the two versions of that DAG:

Screenshot 2023-02-08 at 11 34 00 AM

Screenshot 2023-02-08 at 11 34 09 AM

With task selection working across grid/graph. You can highlight the upstream/downstream even when not hovering or explicitly filtering the whole graph:
Screenshot 2023-02-08 at 12 22 14 PM

We could also experiment with concentrating edges, but there's always going to be trade-offs between different graphing strategies and various DAG structures.

@bbovenzi
Copy link
Contributor Author

bbovenzi commented Feb 8, 2023

Just added the ability to zoom to a selected node to help navigate large graphs:
Feb-08-2023 14-50-45

@eladkal
Copy link
Contributor

eladkal commented Feb 8, 2023

Just added the ability to zoom to a selected node to help navigate large graphs

This is super cool!
BTW a really useful feature would be to select 2 tasks in the list then showing graph view only for these two tasks (all nodes that are between the two) it would be extremely useful for zooming in on a specific flow. Basically what you show with the blue lines but without showing all the rest of the nodes.

@potiuk
Copy link
Member

potiuk commented Feb 8, 2023

❤️ ❤️ ❤️ ❤️ ❤️ ❤️

@notatallshaw-gts
Copy link
Contributor

We could also experiment with concentrating edges, but there's always going to be trade-offs between different graphing strategies and various DAG structures.

Yeah I didn't want to kick of a design discussion in this PR and slow work down, I'm sure once this lands people will have lots of suggestions.

I just wanted to check this didn't introduce regressions in being able to follow edges in complicated graphs, and from that perspective it seems good!

@bbovenzi bbovenzi marked this pull request as ready for review February 8, 2023 20:58
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.

Tested locally and looks great! 🎉

I have a small warning complaining for width/height of parent container:
image

Also it looks like the webpack css loader is not working when being reloaded. (I mean hot realoding):

  • start breeze in dev mode
  • tail -f .build/www/asset_compile_dev_mode.out
  • notice that asset compilation is successful
  • update the code and observe asset rebuild, I have a css loading error on reactflow/dist/style.css. Let me know if you also experience this.

@blag
Copy link
Contributor

blag commented Feb 14, 2023

So looking forward to this. This looks great!

@talnagar
Copy link
Contributor

this feature looks amazing!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows us to import the css file for react-flow inside of react

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have tests that cover task_group_to_dict() and dag_edges()

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

(partial review only)

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.

Very nice! 🎉

bbovenzi and others added 2 commits March 1, 2023 17:30
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
@bbovenzi
Copy link
Contributor Author

bbovenzi commented Mar 2, 2023

Failing check is not because of this PR. Merging.

@bbovenzi bbovenzi merged commit 9172d56 into apache:main Mar 2, 2023
@bbovenzi bbovenzi deleted the grid-graph branch March 2, 2023 00:06
@jedcunningham
Copy link
Member

(#protm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Task Group options in Graph view Create a new graph view in React

10 participants