Skip to content

Commit

Permalink
Always prefer RE over Stampede - forcefully disable Stampede
Browse files Browse the repository at this point in the history
Summary: Remote Execution builds should be now preferred over the distributed builds.

Reviewed By: rajyengi

fbshipit-source-id: 9821a906db
  • Loading branch information
michsien authored and facebook-github-bot committed May 2, 2019
1 parent dcad0db commit 818c619
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/com/facebook/buck/cli/BuildCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ public void setKeepGoing(boolean keepGoing) {
this.keepGoing = keepGoing;
}

public void forceDisableDistributedBuild() {
forceDisableDistributedBuild = true;
}

/** Whether this build is using stampede or not. */
public boolean isUsingDistributedBuild() {
if (forceDisableDistributedBuild) {
Expand Down Expand Up @@ -297,9 +301,7 @@ public DistBuildCommandDelegate getDistBuildCommandDelegate() {
public boolean tryConvertingToStampede(DistBuildConfig config) {
if (forceDisableDistributedBuild) {
LOG.info(
String.format(
"%s has been specified. Will not auto-convert build to stampede.",
LOCAL_BUILD_LONG_ARG));
"Distributed build was forcefully disabled. Will not auto-convert build to stampede.");

useDistributedBuild = false; // Make sure
return false;
Expand Down
26 changes: 18 additions & 8 deletions src/com/facebook/buck/cli/MainRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,24 @@ public ExitCode runMainWithExitCode(
ExecutionEnvironment executionEnvironment =
new DefaultExecutionEnvironment(clientEnvironment, System.getProperties());

// Automatically use distributed build for supported repositories and users.
// Automatically use distributed build for supported repositories and users, unless
// Remote Execution is in use. All RE builds should not use distributed build.
final boolean isRemoteExecutionBuild = isRemoteExecutionBuild(command, buckConfig);
if (command.subcommand instanceof BuildCommand) {
BuildCommand subcommand = (BuildCommand) command.subcommand;
isUsingDistributedBuild = subcommand.isUsingDistributedBuild();
if (!isUsingDistributedBuild
&& (distBuildConfig.shouldUseDistributedBuild(
buildId, executionEnvironment.getUsername(), subcommand.getArguments()))) {
boolean shouldUseDistributedBuild =
distBuildConfig.shouldUseDistributedBuild(
buildId, executionEnvironment.getUsername(), subcommand.getArguments());

if (isRemoteExecutionBuild && (isUsingDistributedBuild || shouldUseDistributedBuild)) {
String msg =
"Remote Execution is enabled. Deprecated distributed build will not be used.";
LOG.warn(msg);
printWarnMessage(msg);
subcommand.forceDisableDistributedBuild();
isUsingDistributedBuild = false;
} else if (!isUsingDistributedBuild && shouldUseDistributedBuild) {
isUsingDistributedBuild = subcommand.tryConvertingToStampede(distBuildConfig);
}
}
Expand Down Expand Up @@ -914,10 +925,10 @@ public ExitCode runMainWithExitCode(
args,
unexpandedCommandLineArgs,
filesystem.getBuckPaths().getLogDir(),
isRemoteExecutionBuild(command, buckConfig));
isRemoteExecutionBuild);

RemoteExecutionConfig remoteExecutionConfig = buckConfig.getView(RemoteExecutionConfig.class);
if (isRemoteExecutionBuild(command, buckConfig)) {
if (isRemoteExecutionBuild) {
remoteExecutionConfig.validateCertificatesOrThrow();
}

Expand Down Expand Up @@ -1058,7 +1069,7 @@ public ExitCode runMainWithExitCode(
logBuckConfig.getBuildDetailsCommands(),
createAdditionalConsoleLinesProviders(
remoteExecutionListener, remoteExecutionConfig, metadataProvider),
isRemoteExecutionBuild(command, buckConfig)
isRemoteExecutionBuild
? Optional.of(
remoteExecutionConfig.getDebugURLString(
metadataProvider.get().getReSessionId()))
Expand Down Expand Up @@ -1168,7 +1179,6 @@ public ExitCode runMainWithExitCode(
.getEventListeners(executors, scheduledExecutorPool.get())
: ImmutableList.of();

final boolean isRemoteExecutionBuild = isRemoteExecutionBuild(command, buckConfig);
if (isRemoteExecutionBuild) {
List<BuckEventListener> remoteExecutionsListeners = Lists.newArrayList();
if (remoteExecutionListener.isPresent()) {
Expand Down

0 comments on commit 818c619

Please sign in to comment.