nx run-many only serves the first 3 specified projects

Created on 21 Nov 2019  路  4Comments  路  Source: nrwl/nx

  • [x] I am running the latest version "@nrwl/workspace": "^8.8.0"
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

all specified projects get served, when running nx run-many --target=serve --projects=<more than 3 projects> --parallel

Current Behavior

only the first 3 projects get served

Failure Information (for bugs)

console outputs:

nx run-many --target=serve --projects=one,two,three,four --parallel

NX  Running target serve for projects:

  - one
  - two
  - three
  - four
[email protected] nx <path-to-project>\nx-min
nx "run" "two:serve"

[email protected] nx <path-to-project>\nx-min
nx "run" "three:serve"

[email protected] nx <path-to-project>\nx-min
nx "run" "one:serve"

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. npx create-nx-workspace@latest nx-min
  2. cd nx-min
  3. nx g @nrwl/nest:application one
  4. nx g @nrwl/nest:application two
  5. nx g @nrwl/nest:application three
  6. nx g @nrwl/nest:application four
  7. change ports so that all four have unique ports
  8. nx run-many --target=serve --projects=one,two,three,four --parallel

Context

Please provide any relevant information about your setup:

  • nx report :
  @nrwl/angular : Not Found
  @nrwl/cli : 8.8.0
  @nrwl/cypress : Not Found
  @nrwl/eslint-plugin-nx : 8.8.0
  @nrwl/express : Not Found
  @nrwl/jest : 8.8.0
  @nrwl/linter : 8.8.0
  @nrwl/nest : 8.8.0
  @nrwl/next : Not Found
  @nrwl/node : 8.8.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 8.8.0
  @nrwl/web : Not Found
  @nrwl/workspace : 8.8.0
  typescript : 3.5.3

Most helpful comment

You should be able to work around this by setting the --maxParallel flag to a high number, for example:

nx run-many --target=serve --projects=one,two,three,four --parallel --maxParallel=100

The default value for --maxParallel is three, meaning that it runs tasks in batches of three by default. Since the "serve" target never exits, the run-many command never made it to the second batch of tasks.

To avoid further confusion about this situation, there could be a warning logged when the "serve" target is used with the run-many command.

All 4 comments

You should be able to work around this by setting the --maxParallel flag to a high number, for example:

nx run-many --target=serve --projects=one,two,three,four --parallel --maxParallel=100

The default value for --maxParallel is three, meaning that it runs tasks in batches of three by default. Since the "serve" target never exits, the run-many command never made it to the second batch of tasks.

To avoid further confusion about this situation, there could be a warning logged when the "serve" target is used with the run-many command.

This is actually a use-case for run-many we didn't consider :) @AdamVig a warning is a good idea, probably not something we are going to do right now, but we would likely accept a PR for it

@AdamVig thanks for the tip
my use-case is running multiple nest services. And I didn`t like the method I used before (here) and when i saw the addition of run-many I had to try it

I'm using nx in a kind of microfront ends and I also want to run several at the same time on the same port, but with different paths ... how would it be possible to do that? do these solutions work or should i go for the idea of a proxy?

Was this page helpful?
0 / 5 - 0 ratings