vs code: Launch multiple configurations at once
Asked Answered
S

1

6

I am playing around with cluster computing and would like to simulate a cluster with one leader node and multiple follower nodes. I can do that by setting up multiple configurations (one for each node). Now, I would like to run all of these configurations at once (or one after another).

Is it possible to do this?

Someone else already tried to solve this question. The solution they came up with was to have a new launch.json in a new .vscode folder for each configuration. This seems to work, but is impractical since I would like to start e.g. 20 (or 100) nodes.

Secretive answered 8/11, 2018 at 18:32 Comment(7)
Did you look at the "compound" option? It can list all your configurations in one place to run in parallel. See code.visualstudio.com/docs/editor/…Okoka
Thanks @Okoka This seems to be exactly what I was looking for!Secretive
Do you know if how to start each configuration in its own external Terminal, @Okoka ?Secretive
unfortunately this idea does not really work. i seem to be able to start 2 nodes. One in an external terminal and one in the integrated terminal. But so far I was not able to start e.e. 10Secretive
I currently use it to start three configurations. Two are node-based gulp tasks and one is the chrome debugger. They all use the debugger console. What do you get in the debugger toolbar dropdown?Okoka
I will try that again tonight. Thank you @OkokaSecretive
No, it does not work. What I can do is start the configurations one after another. Than I am able to switch between consoles. I am not able to start them at once and switch between consoles. Additional Info: I am starting all jobs from a single java file and depending on what params I pass, a different node spawnsSecretive
P
4

https://code.visualstudio.com/docs/editor/debugging#_compound-launch-configurations

Compound launch configurations

An alternative way to start multiple debug sessions is by using a compound launch configuration. A compound launch configuration lists the names of two or more launch configurations that should be launched in parallel. Optionally a preLaunchTask can be specified that is run before the individual debug sessions are started. The boolean flag stopAll controls whether manually terminating one session will stop all of the compound sessions.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Server",
      "program": "${workspaceFolder}/server.js"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Client",
      "program": "${workspaceFolder}/client.js"
    }
  ],
  "compounds": [
    {
      "name": "Server/Client",
      "configurations": ["Server", "Client"],
      "preLaunchTask": "${defaultBuildTask}",
      "stopAll": true
    }
  ]
}

Compound launch configurations are displayed in the launch configuration dropdown menu.

Pumpkin answered 5/5, 2023 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.