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

Add warning to console when serving more than 3 parallel apps #3935

Closed
webberwang opened this issue Oct 18, 2020 · 7 comments
Closed

Add warning to console when serving more than 3 parallel apps #3935

webberwang opened this issue Oct 18, 2020 · 7 comments
Assignees

Comments

@webberwang
Copy link
Contributor

webberwang commented Oct 18, 2020

Description

See terminal output some sort of warning that not all apps are served

Motivation

Give better feedback to what is happening under the hood.

Suggested Implementation

Output warning depending on number of apps running & value of max parallel flag

Alternate Implementations

N/A

Relates to #2088

@vsavkin
Copy link
Member

vsavkin commented Oct 23, 2020

Hi there!

Nx treats all targets the same way, so in this case the warning would show up any time you run run-many --parallel with more than 3 items, which won't work.

We could have special cased it, but I am not sure this is common enough use case to justify this.

@vsavkin vsavkin added the scope: misc Misc issues label Oct 23, 2020
@vsavkin vsavkin self-assigned this Oct 23, 2020
@webberwang
Copy link
Contributor Author

webberwang commented Oct 29, 2020

If I'm running 4 processes, it will run 3 without error, and silently not run the 4th process.

@vsavkin
Copy link
Member

vsavkin commented Nov 20, 2020

A lot of Nx workspaces have hundreds of projects, so when you build/test/lint stuff in parallel, you would never have all your projects built/tested/linted at the same time. For many of them, it's not possible to run them at the same time, because their deps have to be built first.

The only thing I can think of is to change this:

>  NX  Running target mytarget for projects:

To something like this:

>  NX  Running target mytarget for projects in parallel (--max-parallel=3):

My concern is that for most commands this will be unnecessary noise.

@ghost
Copy link

ghost commented Dec 14, 2020

NX allows to build/test/lint many projects. But how to run more than 3 projects in NX?

Does NX recommend serving more than 3 projects in parallel? We are using nx run-many --all --target=serve --parallel --maxParallel=100 by default for development. Are we abusing NX by doing this? What could be alternatives to this? Does NX recommend to organize NX projects such that each project can be developed and debugged stand-alone, or with at most 1 or 2 projects which a project depends on at runtime?

I appreciate any guidance on this.

@vsavkin
Copy link
Member

vsavkin commented Feb 22, 2021

I don't think nx run-many --all --target=serve --parallel --maxParallel=100 is an improper use of Nx. If you want to serve 20 apps at the same, you can use run-many. Most of the time though folks chose to define custom targets serving a given app with its deps.

Something like this:

 "serve-with-deps": {
          "executor": "@nrwl/workspace:run-commands",
          "options": {
            "commands": [
               "nx serve service1",
               "nx serve service2",
               "nx serve service3",
               "nx serve app"
            ],
            "parallel": true
          }
        },

You can then run it like this: nx serve-with-deps app. But if run-many works for you, that's fine. I don't think it is incorrect, but I think it's uncommon. So I'd rather not optimize the DX for uncommon scenarios.

I'm going to close this issue because we aren't planning to add a warning at the moment.

Sorry about it.

@vsavkin vsavkin closed this as completed Feb 22, 2021
@mklinke
Copy link

mklinke commented Feb 23, 2021

FWIW, if anyone's wondering about the limit of 3 parallel apps mentioned in the title of this issue, it seems like it doesn't apply to @vsavkin's proposal to use @nrwl/workspace:run-commands. From the docs:

The commands option accepts as many commands as you want. By default, they all run in parallel. You can run them sequentially by setting parallel: false:
...

Thank you, @vsavkin

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants