Skip to content

[#603][4] Add Core Workflow Graph Services - #616

Merged
zuozhiw merged 52 commits into
masterfrom
new-gui-model-refactor
Jun 20, 2018
Merged

zuozhiw merged 52 commits into
masterfrom
new-gui-model-refactor

Conversation

@zuozhiw

@zuozhiw zuozhiw commented May 29, 2018 •

Copy link
Copy Markdown
Contributor

This PR adds an important piece to the new GUI code: the Workflow Graph Services, which are a set of services that work together to manage the application state: JointJS graph and Texera Graph.

Each service is tested and documented extensively. This PR introduces 54 new test cases, which brings the total number of frontend test cases to 80.

The Design Doc of this module is included in the codebase repo as a markdown file. It is copied here for the convenience:

Workflow Graph Services Design Doc

Workflow Graph is the main model of the application - it represents the logical DAG (directed acyclic graph) composing the workflow plan.
Workflow Graph module contains a group of services that work together to manage the graph and handle the changes to it.

Overview of Texera's Workflow Graph

The class WorkflowGraph defined in workflow-graph.ts implements the graph that holds workflow plan that Texera needed.
Texera backend can run the workflow plan using the information in the WorkflowGraph.

Each operator has several attributes, such as:

  • a unique operator ID
  • operator type
  • texera-specific properties
  • input/output ports
    Each link has:
  • a unique link ID
  • the source operator+port
  • the target operator+port

Overview of JointJS's Graph (joint.dia.Graph)

We use JointJS library to display the graph (operators and links) and let the user to manipulate the graph on the UI.

JointJS has its own model jointGraph: joint.dia.Graph containing the information needed by JointJS to display them.
The model object jointGraph is two-way binded with the view object jointPaper: joint.dia.Paper by JointJS.
Whenver the View jointPaper is changed by the user, the model jointGraph is also automatically changed,
and corresponding events will be emitted. Changing the model can automatically cause the view to be changed accordingly.

Overview of classes in Workflow Graph Services

We maintain two separate models:

  • jointGraph, representing the graph in the UI by JointJS, and texeraGraph
  • texeraGraph, representing the logical DAG workflow (plan) for Texera
    These two models needs to be in sync, and we want to expose a uniform way to change the model and listen to events.
    The operator IDs anre the linkIDs in texeraGraph and jointGraph are the same for all operators and links.

The following classes work together to achieve the sync of two models:

  • WorkflowActionServie: provides the entry points for actions on the graph, such as add/delete operator, add/delete link, etc..
  • TexeraGraph: maintains the actual graph data (operators and links) and provides getters/setters, and event streams
  • JointGraphWrapper: wraps jointGraph and provides getters and event streams in RxJS Observables (instead of callback functions)
  • SyncTexeraModel: subscribes to changes event streams from JointGraphWrapper and sync TexeraGraph accordingly

How to use the services and classes from external modules

If an external module wants to:

  • change the workflow graph: (add/remove operator, add/remove link, change operator property)
    • call specific actions in WorkflowActionServie, jointGraph and texeraGraph will be changed in sync automatically
  • read data or listen to events of texera logical workflow graph:
    • from WorkflowActionServie, get a read-only version of the texera graph TexeraGraphReadonly
    • hasXXX and getXXX methods, as well as getXXXEventStream methods are available
  • access UI properties or events from JointJS: (such as the coordinate of an operator, the event of user dragging an operator/link around)
    • get the properties or subscribe to events from JointGraphWrapper
    • if more properties or event streams are needed, more getter functions can be created in JointGraphWrapper

Internal implementation to keep texera and joint graph in sync

Internally, the workflow graph module manages the sync of JointModelService and TexeraModelService by:

  • WorkflowActionServie calls corresponding methods for JointGraphd and TexeraGraph to make changes

  • For deleteOperator, addLink, and deleteLink

    • only call jointGraph methods. events will propagate to syncTexeraModel, where changes are made
    • these actions can occur either from calling actions in the code, or directly from the UI
    • handlers in syncTexeraModel will be triggered regardless the event is from
  • For addOperator and changeOperatorProperty

    • call both jointGraph methods and texeraGrpah methods, syncTexeraModel won't handle them
    • addOperator could be only triggered inside the code, and we need to pass additional operator data
    • changeOperatorProperty jointJS doesn't have the notion of changing the property of an opeartor

WorkflowActionServie ---(calls)---> JointGraph: addOperator, deleteOperator, addLink, deleteLink
WorkflowActionServie ---(calls)---> TexeraGraph: addOperator, setOperatorProperty
SyncTexeraModel --(subscribes)---> JointGraph: operatorElementDelete, linkCellAdd, linkCellDelete, linkCellChange

Related design slides

zuozhiw and others added 30 commits April 6, 2018 19:26
@chenlica

Copy link
Copy Markdown
Contributor

@zuozhiw and @avinash0161 : given the importance and significance of this PR, I suggest we do a F2F discussion to about the details.

@zuozhiw
zuozhiw changed the base branch from master to new-gui-interface May 29, 2018 19:14
@zuozhiw
zuozhiw requested review from avinash0161 and henrychen0220 and removed request for henrychen0220 May 30, 2018 21:11
Comment thread core/new-gui/tslint.json
"spaces"
],
"interface-over-type-literal": true,
"interface-over-type-literal": false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does setting "interface-over-type-literal" to false do?

- `jointGraph`, representing the graph in the UI by JointJS, and `texeraGraph`
- `texeraGraph`, representing the logical DAG workflow (plan) for Texera
These two models needs to be in sync, and we want to expose a uniform way to change the model and listen to events.
The operator IDs anre the linkIDs in `texeraGraph` and `jointGraph` are the same for all operators and links.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The operator IDs and the linkIDs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@zuozhiw zuozhiw changed the title [#603][4] Add Workflow Graph Services [#603][4] Add Core Workflow Graph Services Jun 3, 2018
@zuozhiw
zuozhiw changed the base branch from new-gui-interface to master June 3, 2018 06:50
* @param jointLink
*/
static getOperatorLink(jointLink: joint.dia.Link): OperatorLink {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to jointLinkEndpointType or something similar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed


/**
* Returns an array of all operators in the graph
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getAllOperators? Similarly, name the function below as getAllLinks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

jointGraphWrapper = new JointGraphWrapper(new joint.dia.Graph());
});

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't there be a "only one link should be added when link addition occurs" and "only one link and no other link should be deleted when link deletion occurs"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IMO they are sort of trival and there are many other test cases about links to make sure that is correct

@avinash0161 avinash0161 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given some minor comments

@zuozhiw
zuozhiw merged commit b946a82 into master Jun 20, 2018
@zuozhiw
zuozhiw deleted the new-gui-model-refactor branch June 24, 2018 13:38
Yicong-Huang added a commit that referenced this pull request Jul 5, 2026
### What changes were proposed in this PR?

Patch-level alignment of all Angular packages in `frontend/`, across the
two Angular release lines:

| Line | Packages | Before | After |
| --- | --- | --- | --- |
| CLI toolchain | `@angular/cli`, `@angular-devkit/build-angular`,
`@angular-devkit/core`, `@angular-devkit/schematics`,
`@schematics/angular` | 21.2.8 | 21.2.18 |
| Framework | `@angular/{core,common,compiler,compiler-cli,localize}` |
21.2.17 | 21.2.17 (unchanged) |
| Framework |
`@angular/{animations,forms,router,platform-browser,platform-browser-dynamic}`
| 21.2.10 | 21.2.17 |
| CDK | `@angular/cdk` | 21.2.8 | 21.2.14 |

(The framework line has no 21.2.18 — 21.2.17 is its latest; CLI and
framework version independently.)

The toolchain bump is security-motivated: 21.2.8 exact-pins several
build-time dependencies with open advisories, which a plain lockfile
refresh cannot move. 21.2.18 re-pins them all to patched versions:

| Pinned dep | Before | After | Dependabot alerts resolved |
| --- | --- | --- | --- |
| undici | 7.24.4 | 7.28.0 |
[#617](https://github.com/apache/texera/security/dependabot/617) (high),
[#614](https://github.com/apache/texera/security/dependabot/614) (high),
[#621](https://github.com/apache/texera/security/dependabot/621),
[#613](https://github.com/apache/texera/security/dependabot/613),
[#623](https://github.com/apache/texera/security/dependabot/623),
[#616](https://github.com/apache/texera/security/dependabot/616) |
| vite | 7.3.2 | 7.3.6 |
[#591](https://github.com/apache/texera/security/dependabot/591) (high),
[#594](https://github.com/apache/texera/security/dependabot/594) |
| piscina | 5.1.4 | 5.2.0 |
[#610](https://github.com/apache/texera/security/dependabot/610) (high)
|
| webpack-dev-server | 5.2.3 | 5.2.5 |
[#609](https://github.com/apache/texera/security/dependabot/609),
[#518](https://github.com/apache/texera/security/dependabot/518) |
| esbuild | 0.27.3 | 0.28.1 |
[#555](https://github.com/apache/texera/security/dependabot/555) |
| postcss | 8.5.6 | 8.5.12 |
[#474](https://github.com/apache/texera/security/dependabot/474) |

13 alerts total (4 high). Not covered here (separate lockfile copies of
the same packages, planned as a follow-up refresh): undici `^6.25.0`
([#622](https://github.com/apache/texera/security/dependabot/622),
[#620](https://github.com/apache/texera/security/dependabot/620),
[#615](https://github.com/apache/texera/security/dependabot/615)) and
vite 8.x
([#593](https://github.com/apache/texera/security/dependabot/593),
[#590](https://github.com/apache/texera/security/dependabot/590)).

The framework/CDK alignment additionally clears the `YN0060`
incorrect-peer-dependency warnings printed on every `yarn install` (the
tree previously mixed 21.2.10 and 21.2.17).

Diff is `frontend/package.json` + the corresponding `yarn.lock`
re-resolution; no config or code changes.

### Any related issues, documentation, discussions?

Closes #6154

### How was this PR tested?

Existing test cases; no behavior change expected.

- `yarn build` (production `ng build`) — succeeds, only pre-existing
CommonJS warnings.
- `yarn test:ci` — all suites pass (`NX Successfully ran target test for
project gui`).

Both were run after each of the two commits (toolchain bump;
framework/CDK alignment).

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5)

---------

(backported from commit fd79073)

Co-authored-by: Claude Fable 5 <[email protected]>
aglinxinyuan pushed a commit to aglinxinyuan/texera that referenced this pull request Jul 5, 2026
…#6155)

### What changes were proposed in this PR?

Patch-level alignment of all Angular packages in `frontend/`, across the
two Angular release lines:

| Line | Packages | Before | After |
| --- | --- | --- | --- |
| CLI toolchain | `@angular/cli`, `@angular-devkit/build-angular`,
`@angular-devkit/core`, `@angular-devkit/schematics`,
`@schematics/angular` | 21.2.8 | 21.2.18 |
| Framework | `@angular/{core,common,compiler,compiler-cli,localize}` |
21.2.17 | 21.2.17 (unchanged) |
| Framework |
`@angular/{animations,forms,router,platform-browser,platform-browser-dynamic}`
| 21.2.10 | 21.2.17 |
| CDK | `@angular/cdk` | 21.2.8 | 21.2.14 |

(The framework line has no 21.2.18 — 21.2.17 is its latest; CLI and
framework version independently.)

The toolchain bump is security-motivated: 21.2.8 exact-pins several
build-time dependencies with open advisories, which a plain lockfile
refresh cannot move. 21.2.18 re-pins them all to patched versions:

| Pinned dep | Before | After | Dependabot alerts resolved |
| --- | --- | --- | --- |
| undici | 7.24.4 | 7.28.0 |
[apache#617](https://github.com/apache/texera/security/dependabot/617) (high),
[apache#614](https://github.com/apache/texera/security/dependabot/614) (high),
[apache#621](https://github.com/apache/texera/security/dependabot/621),
[apache#613](https://github.com/apache/texera/security/dependabot/613),
[apache#623](https://github.com/apache/texera/security/dependabot/623),
[apache#616](https://github.com/apache/texera/security/dependabot/616) |
| vite | 7.3.2 | 7.3.6 |
[apache#591](https://github.com/apache/texera/security/dependabot/591) (high),
[apache#594](https://github.com/apache/texera/security/dependabot/594) |
| piscina | 5.1.4 | 5.2.0 |
[apache#610](https://github.com/apache/texera/security/dependabot/610) (high)
|
| webpack-dev-server | 5.2.3 | 5.2.5 |
[apache#609](https://github.com/apache/texera/security/dependabot/609),
[apache#518](https://github.com/apache/texera/security/dependabot/518) |
| esbuild | 0.27.3 | 0.28.1 |
[apache#555](https://github.com/apache/texera/security/dependabot/555) |
| postcss | 8.5.6 | 8.5.12 |
[apache#474](https://github.com/apache/texera/security/dependabot/474) |

13 alerts total (4 high). Not covered here (separate lockfile copies of
the same packages, planned as a follow-up refresh): undici `^6.25.0`
([apache#622](https://github.com/apache/texera/security/dependabot/622),
[apache#620](https://github.com/apache/texera/security/dependabot/620),
[apache#615](https://github.com/apache/texera/security/dependabot/615)) and
vite 8.x
([apache#593](https://github.com/apache/texera/security/dependabot/593),
[apache#590](https://github.com/apache/texera/security/dependabot/590)).

The framework/CDK alignment additionally clears the `YN0060`
incorrect-peer-dependency warnings printed on every `yarn install` (the
tree previously mixed 21.2.10 and 21.2.17).

Diff is `frontend/package.json` + the corresponding `yarn.lock`
re-resolution; no config or code changes.

### Any related issues, documentation, discussions?

Closes apache#6154

### How was this PR tested?

Existing test cases; no behavior change expected.

- `yarn build` (production `ng build`) — succeeds, only pre-existing
CommonJS warnings.
- `yarn test:ci` — all suites pass (`NX Successfully ran target test for
project gui`).

Both were run after each of the two commits (toolchain bump;
framework/CDK alignment).

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5)

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants