Skip to content

feat: add Maximum number of Parallelism branches to env #15964

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

XiaoBa-Yu
Copy link
Contributor

@XiaoBa-Yu XiaoBa-Yu commented Mar 17, 2025

Summary

Need to increase the maximum number of parallel branches.

Tip

Resolves #15969.

Screenshots

1742181395768
Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Mar 17, 2025
@crazywoola
Copy link
Member

crazywoola commented Mar 17, 2025

Please see this PR feat: env MAX_TOOLS_NUM (#15431).

You need to add those files in the docker-compose.yaml as well. And don't forget to link an existing issue or create one.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 17, 2025
@XiaoBa-Yu
Copy link
Contributor Author

Please see this PR feat: env MAX_TOOLS_NUM (#15431).

You need to add those files in the docker-compose.yaml as well. And don't forget to link an existing issue or create one.

Modified as requested, thanks

@crazywoola
Copy link
Member

export const PARALLEL_LIMIT = 10

I think you should read the new variable here.

@XiaoBa-Yu
Copy link
Contributor Author

export const PARALLEL_LIMIT = 10

I think you should read the new variable here.

Sorry, I don't quite understand what you mean, could you explain it in more detail?

@crazywoola
Copy link
Member

At the moment I don't see the front-end code reading this newly defined variable

@XiaoBa-Yu
Copy link
Contributor Author

At the moment I don't see the front-end code reading this newly defined variable

image
image
I did not define new variables, I just modified the original variables.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 18, 2025
@crazywoola crazywoola merged commit 5e52d4d into langgenius:main Mar 18, 2025
9 checks passed
@SimonPP123
Copy link

How can I make the maximum parallel limit to 100 for example? I tried different approaches, but nothing helped:
https://take.ms/svfEs5

@XiaoBa-Yu
Copy link
Contributor Author

How can I make the maximum parallel limit to 100 for example? I tried different approaches, but nothing helped: https://take.ms/svfEs5

image
image

@SimonPP123
Copy link

How can I make the maximum parallel limit to 100 for example? I tried different approaches, but nothing helped: https://take.ms/svfEs5

image image

Thanks for the screenshots and clear examples!
I did it, but nothing was changed - https://take.ms/PHDm9
In the repository there is no .env file for web, there is only .env.example and I copied it and created .env file based on .env.example.
In .env file of docker, there was no MAX_PARALLEL_LIMIT variable, so I needed to add it. I made it MAX_PARALLEL_LIMIT=100
I restarted the all containers in the docker but the changes were not processed.

@SimonPP123
Copy link

It is working for Loop node, but not for iteration:
Loop - https://take.ms/7aUro
Iteration - https://take.ms/Rt2CC

parambharat pushed a commit to parambharat/dify that referenced this pull request Mar 31, 2025
@DavideDelbianco
Copy link

This PR is wrong

@DavideDelbianco
Copy link

DavideDelbianco commented Apr 4, 2025

@XiaoBa-Yu if you want to contribute to public project, you have to understand how it works, and you have to test your modifications.

The project uses a docker-compose that reads ENVIRONMENT_VARIABLE from the .env file copied from
Image

You probably copied code from
The PR #14863 by @Woo0ood
That introduced the ENVIRONMENT VARIABLE
LOOP_NODE_MAX_COUNT=100
Image

That value is used in the project web, the project has its own Dockerfile and it is made to read variables from his own .env file
Image

Inspecting the file you should notice that all the ENVIRONMENT VARIABLES are prefixed with NEXT_PUBLIC_
Image

To use the ENVIRONMENT VARIABLE value in the typescript code there's a file that reads the value and exports a CONSTANT VARIABLE
The file is: web/config/index.ts

Image

That CONSTANT VARIABLE is then used in the front-end Typescript files by importing it:
Image

By now, you should ask yourself: "how is it possible that the CONSTANT variable in the code reads its value from an ENVIRONMENT variable that has a name DIFFERENT from the one that I change in the docker-compose ??"

The answer is:
Image

Image
There's NO magic, the variables are re-exported.

@Woo0ood unfortunately forgot this step.

With this PR #15964
You introduced the variable MAX_PARALLEL_LIMIT

@SimonPP123 Objected that it was NOT working
Ironically you give instructions with a screenshot where you are marking two DIFFERENT variables.

You have another PR #16805 where you used the correct file to read variable
Yet even if those two PR are closely related you managed to to the same thing in 2 different files.

web/app/components/workflow/constants.ts
for NEXT_PUBLIC_MAX_PARALLEL_LIMIT introduces the env variables in a file that had none

In the other PR #16805 that is after this one, you correctly use:
web/config/index.ts
for NEXT_PUBLIC_MAX_ITERATIONS_NUM

but did not come back to this PR to fix it

@XiaoBa-Yu
Copy link
Contributor Author

它适用于循环节点,但非用于迭代: 循环 - https://take.ms/7aUro 迭代 - https://take.ms/Rt2CC

It is working for Loop node, but not for iteration: Loop - https://take.ms/7aUro Iteration - https://take.ms/Rt2CC

Sorry, I misunderstood your question before.

iteration

Sorry, I misunderstood your question. The 'Maximum parallelism' variable of the iteration node currently does not support env settings. The 'Maximum Loop Count' variable of the loop node is set by the NEXT_PUBLIC_LOOP_NODE_MAX_COUNT environment variable.

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
🌊 feat:workflow Workflow related stuff. lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to increase the maximum number of parallel branches
4 participants