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

Make bazel run works with minimal mode #16545

Closed
wants to merge 4 commits into from

Conversation

coeuvre
Copy link
Member

@coeuvre coeuvre commented Oct 25, 2022

Always use ToplevelArtifactsDownloader when building without the bytes.

It checks the combination of current command (e.g. build, run, etc.) and download mode (e.g. toplevel, minimal) to decide whether download outputs for the toplevel targets or not.

Also in the RunCommand, we wait for the background downloads before checking the local filesystem.

Fixes #11920.

@coeuvre coeuvre requested a review from a team as a code owner October 25, 2022 12:28
@coeuvre coeuvre requested a review from tjgq October 25, 2022 14:04
@ShreeM01 ShreeM01 added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Oct 25, 2022
boolean useToplevelDownloader = remoteOutputsMode.downloadToplevelOutputsOnly();

// Download toplevel artifacts for `run` command.
if ("run".equals(env.getCommandName())) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to support other commands (e.g. coverage, mobile-install, etc.). Do you think whether it is better if we always use toplevel downloader but pass in the download mode, let the downloaders decide what to download in both minimal/toplevel mode?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it does seem better to keep all of that logic in the downloader.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

boolean useToplevelDownloader = remoteOutputsMode.downloadToplevelOutputsOnly();

// Download toplevel artifacts for `run` command.
if ("run".equals(env.getCommandName())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it does seem better to keep all of that logic in the downloader.

@@ -306,6 +306,14 @@ public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult opti
return BlazeCommandResult.detailedExitCode(result.getDetailedExitCode());
}

if (env.getOutputService() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here explaining why this is necessary (since a casual reader of RunCommand.java might not be familiar with BwoB).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@copybara-service copybara-service bot closed this in dce6ed7 Nov 9, 2022
@coeuvre
Copy link
Member Author

coeuvre commented Nov 9, 2022

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Nov 9, 2022
@coeuvre coeuvre deleted the fix-bazel-run branch November 9, 2022 11:11
coeuvre added a commit to coeuvre/bazel that referenced this pull request Nov 22, 2022
Always use `ToplevelArtifactsDownloader` when building without the bytes.

It checks the combination of current command (e.g. `build`, `run`, etc.) and download mode (e.g. `toplevel`, `minimal`) to decide whether download outputs for the toplevel targets or not.

Also in the `RunCommand`, we wait for the background downloads before checking the local filesystem.

Fixes bazelbuild#11920.

Closes bazelbuild#16545.

PiperOrigin-RevId: 487181884
Change-Id: I6b1a78a0d032d2cac8093eecf9c4d2e76f90380f
ShreeM01 pushed a commit that referenced this pull request Nov 22, 2022
Always use `ToplevelArtifactsDownloader` when building without the bytes.

It checks the combination of current command (e.g. `build`, `run`, etc.) and download mode (e.g. `toplevel`, `minimal`) to decide whether download outputs for the toplevel targets or not.

Also in the `RunCommand`, we wait for the background downloads before checking the local filesystem.

Fixes #11920.

Closes #16545.

PiperOrigin-RevId: 487181884
Change-Id: I6b1a78a0d032d2cac8093eecf9c4d2e76f90380f
@meteorcloudy meteorcloudy removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-Remote-Exec Issues and PRs for the Execution (Remote) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UX: make --remote_download_output=minimal download the necessary files when invoking bazel run
5 participants