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

Support running multiple tartgets in parallel #10855

Closed
jjangga0214 opened this issue Feb 25, 2020 · 9 comments
Closed

Support running multiple tartgets in parallel #10855

jjangga0214 opened this issue Feb 25, 2020 · 9 comments
Labels
not stale Issues or PRs that are inactive but not considered stale P3 We're not considering working on this, but happy to review a PR. (No assignee) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request

Comments

@jjangga0214
Copy link

jjangga0214 commented Feb 25, 2020

Hi, currently bazel does not support multiple targets at once.

For example,
bazel run //foo:bin //bar:bin
only runs //foo:bin, not both.

I think it'd be really convenient in such a case when we want to run multiple processes in parallel (e.g. web applications) in a local development environment.

Though there's https://github.com/atlassian/bazel-tools/tree/master/multirun, its list has to be written statically. When there are many runnable targets, declaring every possible combination, or writing temporary multirun target would be somewhat cumbersome.

So allowing multiple targets by CLI would still be helpful.

P.S. For the case you wants to hear a use case, I share mine here. Currently my monorepo consist of microservices. I want to run binary targets dynamically (not static multirun target) in my development environment. Choosing what to run "dynamically" by CLI is our strong workflow requirement. Thus, I'm using Bazel only for "build", but not to "run(binary)" them right now. And this discrepancy make me feel not 100% assured of "built" services, as I haven't run them with Bazel. I hope to fully migrate to Bazel once the feature is implemented. But anyway I think this feature would be helpful to other people with different context and needs.

@jin jin added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged labels Feb 28, 2020
@bigkraig
Copy link

@jjangga0214 I use Pulumi to deploy the development environment to a local Kubernetes cluster to run my services there. It's a bit more like reality with the caveat that rules_docker is somewhat limited on what can be used as a tag leading to the image tags changing for every Bazel run.

@philwo philwo added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Dec 8, 2020
@mancini0
Copy link

mancini0 commented Feb 2, 2021

if you are using rules_k8s you can use the k8s_objects rule to apply commands to all of your microservices. (Run, deploy, etc.)

@twheys
Copy link

twheys commented Jun 8, 2021

In addition, it would be a nice feature if once could specify "run" dependencies. For example, if I run my node server, then I should start my backend server as well.

@pavi2410
Copy link

Any updates on this? Is this on the roadmap?

@keith
Copy link
Member

keith commented Jan 21, 2023

There are some rules implementations out there for this like mine: https://github.com/keith/rules_multirun

@pavi2410
Copy link

It looks like it doesn't support Windows, does it?

@keith
Copy link
Member

keith commented Jan 21, 2023

No it doesn't right now. I don't have a windows machine to test with but it shouldn't be hard to add support. Or write your own rules with the same idea

Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Mar 27, 2024
@brentleyjones brentleyjones added not stale Issues or PRs that are inactive but not considered stale and removed stale Issues or PRs that are stale (no activity for 30 days) labels Mar 27, 2024
@lberki
Copy link
Contributor

lberki commented Oct 14, 2024

I'll close this as "not planned".

I do realize that this is a common need (this is the third most popular issue in our issue tracker), but Bazel cannot be everything for everyone and it's not a good idea to get into the business of process management after Bazel itself has finished running.

If we implemented this, we'd have to figure out (without an attempt at completeness):

  • If the multiple run targets should be run in parallel or sequentially
  • What happens when one binary errors out but another does not
  • How to run the binaries in the background
  • Where stdout/stderr/stdout of these binaries are connected to

All of which are interesting questions, but not ones for a build tool to solve. I could imagine doing this in custom code: specifying a single rule to run in a BUILD file that then depends on the binaries you actually want to run and which then runs them in the way you want like https://github.com/keith/rules_multirun , but it's not something we want to maintain as a core part of Bazel.

@lberki lberki closed this as completed Oct 14, 2024
@fmeum fmeum reopened this Oct 14, 2024
@fmeum fmeum closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not stale Issues or PRs that are inactive but not considered stale P3 We're not considering working on this, but happy to review a PR. (No assignee) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

No branches or pull requests