lerna run parallelism

Created on 28 Feb 2019  路  2Comments  路  Source: lerna/lerna


Is lerna run supposed to run packages scripts without parallelism? Looking to the docs, since there is the --parallel option, seems to me that the default behavior is to run tests without parallelism.
If I'm correct maybe it's a bug, if not, that could be a new feature.

Expected Behavior



I'm using lerna run test to run all my packages test suites and I need that runs without parallelism.

Current Behavior



The behaviors of these scripts aren't the same:
npx lerna run test and npx lerna run test --scope pkgA && npx lerna run test --scoke pkgB

Possible Solution



If it isn't a bug, maybe an option --no-parallelism?

Steps to Reproduce (for bugs)



The code that I'm using to that is still as local branch, but I can share that soon if that can help.

lerna.json


<!-- Please paste your `lerna.json` here -->
{
  "packages": [
    "packages/*"
  ],
  "version": "0.0.9"
}

Context



Thoses tests are running against a local blockchain and I'm trying to avoid to start the local blockchain process for each test suite. They are isolated (the blockchain state is been reverted after each test suite) but parellelism isn't desirable.

Your Environment

| Executable | Version |
| ---: | :--- |
| lerna --version | 3.6.0 | (I've updated to 3.13.1 but behavior keeps the same)
| npm --version | 6.4.1 |
| node --version | 10.13.0 |

| OS | Version |
| --- | --- |
| Debian | 9.6 |

Most helpful comment

Since I just learned a ton about this for my own particular issue, here's my understanding.

lerna's --parallel is more of --parallel-yolo. Normally lerna run takes into account the "topological" structure of your repo (https://github.com/lerna/lerna/tree/master/core/global-options#--no-sort), determining dependency order in order to ensure that output from pkgA is available to some pkgDependsOnA. But it will run scripts in pkgA and pkgIndependentFromA in parallel. The --parallel flag says "forget about topology and concurrency limits and run this script in every package asap".

However, I think if you were to set --concurrency 1 (https://github.com/lerna/lerna/tree/master/core/global-options#--concurrency) you might get your desired behavior.

All 2 comments

Since I just learned a ton about this for my own particular issue, here's my understanding.

lerna's --parallel is more of --parallel-yolo. Normally lerna run takes into account the "topological" structure of your repo (https://github.com/lerna/lerna/tree/master/core/global-options#--no-sort), determining dependency order in order to ensure that output from pkgA is available to some pkgDependsOnA. But it will run scripts in pkgA and pkgIndependentFromA in parallel. The --parallel flag says "forget about topology and concurrency limits and run this script in every package asap".

However, I think if you were to set --concurrency 1 (https://github.com/lerna/lerna/tree/master/core/global-options#--concurrency) you might get your desired behavior.

Thank you very much! That solved my problem.
Closing the issue.

Was this page helpful?
0 / 5 - 0 ratings