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

Question: is there a simple way to run a single command with n concurrency? #426

Open
jrnail23 opened this issue Jun 8, 2023 · 5 comments
Labels

Comments

@jrnail23
Copy link

jrnail23 commented Jun 8, 2023

I'm looking for a way to easily run the same command in parallel, specifying the number of concurrent executions. Does concurrently support that?

@gustavohenke
Copy link
Member

Like --max-processes? 🙂

@jrnail23
Copy link
Author

But does that allow you to run one single command concurrently?

@jrnail23 jrnail23 changed the title Question: is there a simple way to run the same command with n concurrency? Question: is there a simple way to run a single command with n concurrency? Jun 30, 2023
@gustavohenke
Copy link
Member

No, I misunderstood your initial request.

So you're looking at a way to e.g. run echo "hello world" N times?

@jrnail23
Copy link
Author

@gustavohenke, yes, exactly

@gustavohenke
Copy link
Member

gustavohenke commented Jul 15, 2023

There's nothing like that in the CLI currently, though there's some special syntax that could be built on, e.g. concurrently "npm:*(!fix) -- {@}" is valid.
So you could have for example concurrently "echo Hello world{1:5}" or similar (I'm pretty sure some programming language has syntax like this, but I can't remember which 🤦).

Another option would be through the addition of a new flag, but I'm not sure how to make it ergonomic.

Finally, you can always do whatever you want programmatically:

import concurrently from 'concurrently';
concurrently(Array({ length: 5 }, (_, i) => `echo "Hello world${i}"`))

thoughts, @paescuj?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants