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

feat: Implement new partial execution logic for acyclic workflows (no-changelog) #10256

Merged
merged 54 commits into from
Sep 18, 2024

Conversation

despairblue
Copy link
Contributor

@despairblue despairblue commented Jul 31, 2024

Summary

This PR is rather big.
It does contain TODOs and functions that miss implementation. I'm aware of that, but still find that getting this into trunk now and creating smaller PRs for the TODOs and missing functionality will make future reviewing easier.

It's mostly new files that connect with the old code via one feature gate in the POST /workflows/run controller/service.
The new functionality should not have an effect on the old code.

The new code follows the spec written here: https://www.notion.so/n8n/Partial-Executions-9f24ffe8c6474eaeab51c9784ad1fd46?p=4298d34eb54f42e1baa098c9ccc50b5a&pm=s

Changes to the old code are kept to a minimum to avoid breaking the old partial execution flow. The goal is to remove all old code after the new partial executions flow saw enough testing.

I also added some comments to parts of the code that I did not immediately understand.

Important Review Notes

It's best to start reviewing with this file: packages/core/src/WorkflowExecute.ts

Everything in cypress/* is only done to make the interceptors still work with POST /workflow/run having a query parameter now.

All the new code including the tests are in packages/core/src/PartialExecutionUtils neatly separated by modules that align with the aforementioned spec.

The editor code only contains small adjustments to allow for switching between the old and new flow using a key in local storage.

If you're done with all these, you pretty much reviewed 90% of the PR. Congratulations!

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/PAY-1755/phase-1-partial-execution-logic-in-basic-workflows

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@despairblue despairblue changed the title feat: implement new partial execution logic for acyclic workflows (no-changelog) feat: Implement new partial execution logic for acyclic workflows (no-changelog) Jul 31, 2024
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Jul 31, 2024
@despairblue despairblue force-pushed the pay-1727-spike-partial-execution-logic branch from a916157 to 55b3264 Compare August 1, 2024 13:08
@despairblue despairblue force-pushed the pay-1727-spike-partial-execution-logic branch from 55b3264 to fe50536 Compare August 1, 2024 14:06
@despairblue despairblue force-pushed the pay-1727-spike-partial-execution-logic branch 2 times, most recently from 91a3552 to 37f5e28 Compare August 2, 2024 12:12
@despairblue despairblue force-pushed the pay-1727-spike-partial-execution-logic branch from 37f5e28 to 320eeb7 Compare August 30, 2024 12:37
@despairblue despairblue force-pushed the pay-1727-spike-partial-execution-logic branch from 5b30dfc to 11685f5 Compare September 18, 2024 09:29
@despairblue despairblue requested a review from tomi September 18, 2024 09:55
tomi
tomi previously approved these changes Sep 18, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Nice work. Nothing anymore that would block merging this 🚀

packages/core/src/PartialExecutionUtils/DirectedGraph.ts Outdated Show resolved Hide resolved
packages/core/src/PartialExecutionUtils/DirectedGraph.ts Outdated Show resolved Hide resolved
Comment on lines +51 to +61
//function findAllPinnedActivators(workflow: Workflow, pinData?: IPinData) {
// return Object.values(workflow.nodes)
// .filter(
// (node) =>
// !node.disabled &&
// pinData?.[node.name] &&
// ['trigger', 'webhook'].some((suffix) => node.type.toLowerCase().endsWith(suffix)) &&
// node.type !== 'n8n-nodes-base.respondToWebhook',
// )
// .sort((a) => (a.type.endsWith('webhook') ? -1 : 1));
//}
Copy link
Contributor

Choose a reason for hiding this comment

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

Commented out function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove this in a future PR. It's referenced in the todo above, so I don't forget:

// TODO: add the other filters here from `findAllPinnedActivators`, see
// copy below.

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link

cypress bot commented Sep 18, 2024

n8n    Run #6941

Run Properties:  status check passed Passed #6941  •  git commit 87cbab8f62: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 despairblue 🗃️ e2e/*
Project n8n
Branch Review pay-1727-spike-partial-execution-logic
Run status status check passed Passed #6941
Run duration 04m 37s
Commit git commit 87cbab8f62: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 despairblue 🗃️ e2e/*
Committer Danny Martini
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 430
View all changes introduced in this branch ↗︎

Co-authored-by: Tomi Turtiainen <[email protected]>
@despairblue despairblue requested a review from tomi September 18, 2024 12:51
Copy link
Contributor

✅ All Cypress E2E specs passed

@despairblue despairblue merged commit 2a084f9 into master Sep 18, 2024
33 checks passed
@despairblue despairblue deleted the pay-1727-spike-partial-execution-logic branch September 18, 2024 13:06
riascho pushed a commit that referenced this pull request Sep 23, 2024
@janober
Copy link
Member

janober commented Sep 25, 2024

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants