forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remote: Display download progress when actions are downloading output…
…s from remote cache. Normally, when executing action with remote cache/execution, the UI only display the "remote"/"remote-cache" strategy: ``` [500 / 1000] 500 actions, 3 running [Sched] Executing genrule //:test-1; Executing genrule //:test-2; 2s remote Executing genrule //:test-3; 3s remote ... ``` However, it doesn't tell users what is happening under the hood. bazelbuild#13555 fixed the confusion which the UI display the action is scheduling while it is actually downloading the outputs. With this change, Bazel will display the downloads if action is downloading outputs. e.g. ``` [500 / 1000] 500 actions, 3 running [Sched] Executing genrule //:test-1; 1s remote Executing genrule //:test-2; Downloading 2.out, 20.1 KiB / 100 KiB; 2s remote Executing genrule //:test-3; 3s remote ... ``` Add a generic `ActionProgressEvent` which can be reported within action execution to display detailed execution progress for that action. Closes bazelbuild#13557. PiperOrigin-RevId: 383224334
- Loading branch information
1 parent
ec3d4bd
commit 0f812eb
Showing
16 changed files
with
619 additions
and
36 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/com/google/devtools/build/lib/actions/ActionProgressEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2021 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.actions; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike; | ||
|
||
/** Notifications for the progress of an in-flight action. */ | ||
@AutoValue | ||
public abstract class ActionProgressEvent implements ProgressLike { | ||
|
||
public static ActionProgressEvent create( | ||
ActionExecutionMetadata action, String progressId, String progress, boolean finished) { | ||
return new AutoValue_ActionProgressEvent(action, progressId, progress, finished); | ||
} | ||
|
||
/** Gets the metadata associated with the action being scheduled. */ | ||
public abstract ActionExecutionMetadata action(); | ||
|
||
/** The id that uniquely determines the progress among all progress events within an action. */ | ||
public abstract String progressId(); | ||
|
||
/** Human readable description of the progress. */ | ||
public abstract String progress(); | ||
|
||
/** Whether the download progress reported about is finished already. */ | ||
public abstract boolean finished(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/google/devtools/build/lib/exec/SpawnProgressEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2021 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.exec; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import com.google.devtools.build.lib.actions.ActionExecutionMetadata; | ||
import com.google.devtools.build.lib.actions.ActionProgressEvent; | ||
import com.google.devtools.build.lib.events.ExtendedEventHandler; | ||
import com.google.devtools.build.lib.exec.SpawnRunner.ProgressStatus; | ||
|
||
/** The {@link SpawnRunner} is making some progress. */ | ||
@AutoValue | ||
public abstract class SpawnProgressEvent implements ProgressStatus { | ||
|
||
public static SpawnProgressEvent create(String resourceId, String progress, boolean finished) { | ||
return new AutoValue_SpawnProgressEvent(resourceId, progress, finished); | ||
} | ||
|
||
/** The id that uniquely determines the progress among all progress events for this spawn. */ | ||
abstract String progressId(); | ||
|
||
/** Human readable description of the progress. */ | ||
abstract String progress(); | ||
|
||
/** Whether the progress reported about is finished already. */ | ||
abstract boolean finished(); | ||
|
||
@Override | ||
public void postTo(ExtendedEventHandler eventHandler, ActionExecutionMetadata action) { | ||
eventHandler.post(ActionProgressEvent.create(action, progressId(), progress(), finished())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/google/devtools/build/lib/remote/common/ProgressStatusListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2021 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.remote.common; | ||
|
||
import com.google.devtools.build.lib.exec.SpawnRunner.ProgressStatus; | ||
|
||
/** An interface that is used to receive {@link ProgressStatus} updates during spawn execution. */ | ||
@FunctionalInterface | ||
public interface ProgressStatusListener { | ||
|
||
void onProgressStatus(ProgressStatus progress); | ||
|
||
/** A {@link ProgressStatusListener} that does nothing. */ | ||
ProgressStatusListener NO_ACTION = | ||
progress -> { | ||
// Intentionally left empty | ||
}; | ||
} |
Oops, something went wrong.