Skip to content

Commit

Permalink
chore: update bazel to 6.4.0 (bazelbuild#1513)
Browse files Browse the repository at this point in the history
Trying to get more info on the Lombok stamping issue on Windows CI.
See also bazelbuild/bazel#10363 and
bazelbuild/bazel#18185

Rename instance types (bazelbuild#1514)

feat: Implement CAS lease extension

Run formatter

Remove ExecutorPool, Instead make fire and forget call to worker:fmb
  • Loading branch information
jasonschroeder-sfdc authored and amishra-u committed Oct 30, 2023
1 parent 4d79d16 commit 0967547
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.2
6.4.0
8 changes: 4 additions & 4 deletions admin/main/src/main/resources/proto/buildfarm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ message RedisShardBackplaneConfig {
int32 max_attempts = 33;
}

message ShardInstanceConfig {
message ServerInstanceConfig {
bool run_dispatched_monitor = 1;

int32 dispatched_monitor_interval_seconds = 2;
Expand All @@ -544,7 +544,7 @@ message ShardInstanceConfig {
google.protobuf.Duration grpc_timeout = 8;
}

message ShardWorkerInstanceConfig {
message WorkerInstanceConfig {
// whether to stream stdout from processes
bool stream_stdout = 6;

Expand All @@ -568,7 +568,7 @@ message ShardWorkerInstanceConfig {
}

message ShardWorkerConfig {
ShardWorkerInstanceConfig shard_worker_instance_config = 1;
WorkerInstanceConfig shard_worker_instance_config = 1;

int32 port = 2;

Expand Down Expand Up @@ -836,7 +836,7 @@ message InstanceConfig {

oneof type {
MemoryInstanceConfig memory_instance_config = 3;
ShardInstanceConfig shard_instance_config = 4;
ServerInstanceConfig shard_instance_config = 4;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* single per-process pool.
*/
public class BuildfarmExecutors {

public static ExecutorService getScanCachePool() {
int nThreads = SystemProcessors.get();
String threadNameFormat = "scan-cache-pool-%d";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/build/buildfarm/instance/server/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
java_library(
name = "server",
srcs = [
"AbstractServerInstance.java",
"GetDirectoryFunction.java",
"NodeInstance.java",
"OperationsMap.java",
"WatchFuture.java",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
import lombok.extern.java.Log;

@Log
public abstract class AbstractServerInstance implements Instance {
public abstract class NodeInstance implements Instance {
private final String name;
protected final ContentAddressableStorage contentAddressableStorage;
protected final ActionCache actionCache;
Expand Down Expand Up @@ -229,7 +229,7 @@ public abstract class AbstractServerInstance implements Instance {
public static final String NO_REQUEUE_COMPLETE_MESSAGE =
"Operation %s not requeued. Operation has already completed.";

public AbstractServerInstance(
public NodeInstance(
String name,
DigestUtil digestUtil,
ContentAddressableStorage contentAddressableStorage,
Expand Down Expand Up @@ -1967,19 +1967,18 @@ public ServerCapabilities getCapabilities() {
@Override
public WorkerProfileMessage getWorkerProfile() {
throw new UnsupportedOperationException(
"AbstractServerInstance doesn't support getWorkerProfile() method.");
"NodeInstance doesn't support getWorkerProfile() method.");
}

@Override
public WorkerListMessage getWorkerList() {
throw new UnsupportedOperationException(
"AbstractServerInstance doesn't support getWorkerList() method.");
throw new UnsupportedOperationException("NodeInstance doesn't support getWorkerList() method.");
}

@Override
public PrepareWorkerForGracefulShutDownRequestResults shutDownWorkerGracefully() {
throw new UnsupportedOperationException(
"AbstractServerInstance doesn't support drainWorkerPipeline() method.");
"NodeInstance doesn't support drainWorkerPipeline() method.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import build.buildfarm.common.DigestUtil;
import build.buildfarm.common.InputStreamFactory;
import build.buildfarm.instance.Instance;
import build.buildfarm.instance.shard.ShardInstance.WorkersCallback;
import build.buildfarm.instance.shard.ServerInstance.WorkersCallback;
import com.google.common.base.Throwables;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Iterables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import build.buildfarm.common.grpc.UniformDelegateServerCallStreamObserver;
import build.buildfarm.instance.Instance;
import build.buildfarm.instance.MatchListener;
import build.buildfarm.instance.server.AbstractServerInstance;
import build.buildfarm.instance.server.NodeInstance;
import build.buildfarm.operations.EnrichedOperation;
import build.buildfarm.operations.FindOperationsResults;
import build.buildfarm.v1test.BackplaneStatus;
Expand Down Expand Up @@ -169,7 +169,7 @@
import org.apache.commons.lang3.tuple.Pair;

@Log
public class ShardInstance extends AbstractServerInstance {
public class ServerInstance extends NodeInstance {
private static final ListenableFuture<Void> IMMEDIATE_VOID_FUTURE = Futures.immediateFuture(null);

private static final String TIMEOUT_OUT_OF_BOUNDS =
Expand Down Expand Up @@ -261,14 +261,14 @@ private static Backplane createBackplane(String identifier) throws Configuration
identifier,
/* subscribeToBackplane=*/ true,
configs.getServer().isRunFailsafeOperation(),
ShardInstance::stripOperation,
ShardInstance::stripQueuedOperation);
ServerInstance::stripOperation,
ServerInstance::stripQueuedOperation);
} else {
throw new IllegalArgumentException("Shard Backplane not set in config");
}
}

public ShardInstance(String name, String identifier, DigestUtil digestUtil, Runnable onStop)
public ServerInstance(String name, String identifier, DigestUtil digestUtil, Runnable onStop)
throws InterruptedException, ConfigurationException {
this(
name,
Expand All @@ -278,7 +278,7 @@ public ShardInstance(String name, String identifier, DigestUtil digestUtil, Runn
/* actionCacheFetchService=*/ BuildfarmExecutors.getActionCacheFetchServicePool());
}

private ShardInstance(
private ServerInstance(
String name,
DigestUtil digestUtil,
Backplane backplane,
Expand Down Expand Up @@ -330,7 +330,7 @@ void initializeCaches() {
.build();
}

public ShardInstance(
public ServerInstance(
String name,
DigestUtil digestUtil,
Backplane backplane,
Expand Down Expand Up @@ -1127,7 +1127,7 @@ public void onError(Throwable t) {
backplane,
workerSet,
locationSet,
ShardInstance.this::workerStub,
ServerInstance.this::workerStub,
blobDigest,
directExecutor(),
RequestMetadata.getDefaultInstance()),
Expand Down Expand Up @@ -2292,7 +2292,7 @@ public ListenableFuture<Void> queue(ExecuteEntry executeEntry, Poller poller, Du
log.log(
Level.FINER,
format(
"ShardInstance(%s): checkCache(%s): %sus elapsed",
"ServerInstance(%s): checkCache(%s): %sus elapsed",
getName(), operation.getName(), checkCacheUSecs));
return IMMEDIATE_VOID_FUTURE;
}
Expand All @@ -2319,7 +2319,7 @@ private ListenableFuture<Void> transformAndQueue(
log.log(
Level.FINER,
format(
"ShardInstance(%s): queue(%s): fetching action %s",
"ServerInstance(%s): queue(%s): fetching action %s",
getName(), operation.getName(), actionDigest.getHash()));
RequestMetadata requestMetadata = executeEntry.getRequestMetadata();
ListenableFuture<Action> actionFuture =
Expand Down Expand Up @@ -2362,7 +2362,7 @@ private ListenableFuture<Void> transformAndQueue(
log.log(
Level.FINER,
format(
"ShardInstance(%s): queue(%s): fetched action %s transforming queuedOperation",
"ServerInstance(%s): queue(%s): fetched action %s transforming queuedOperation",
getName(), operation.getName(), actionDigest.getHash()));
Stopwatch transformStopwatch = Stopwatch.createStarted();
return transform(
Expand Down Expand Up @@ -2392,7 +2392,7 @@ private ListenableFuture<Void> transformAndQueue(
log.log(
Level.FINER,
format(
"ShardInstance(%s): queue(%s): queuedOperation %s transformed, validating",
"ServerInstance(%s): queue(%s): queuedOperation %s transformed, validating",
getName(),
operation.getName(),
DigestUtil.toString(
Expand All @@ -2414,7 +2414,7 @@ private ListenableFuture<Void> transformAndQueue(
log.log(
Level.FINER,
format(
"ShardInstance(%s): queue(%s): queuedOperation %s validated, uploading",
"ServerInstance(%s): queue(%s): queuedOperation %s validated, uploading",
getName(),
operation.getName(),
DigestUtil.toString(
Expand Down Expand Up @@ -2466,7 +2466,7 @@ public void onSuccess(ProfiledQueuedOperationMetadata profiledQueuedMetadata) {
log.log(
Level.FINER,
format(
"ShardInstance(%s): queue(%s): %dus checkCache, %dus transform, %dus validate, %dus upload, %dus queue, %dus elapsed",
"ServerInstance(%s): queue(%s): %dus checkCache, %dus transform, %dus validate, %dus upload, %dus queue, %dus elapsed",
getName(),
queueOperation.getName(),
checkCacheUSecs,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/build/buildfarm/server/BuildFarmServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import build.buildfarm.common.services.ByteStreamService;
import build.buildfarm.common.services.ContentAddressableStorageService;
import build.buildfarm.instance.Instance;
import build.buildfarm.instance.shard.ShardInstance;
import build.buildfarm.instance.shard.ServerInstance;
import build.buildfarm.metrics.prometheus.PrometheusPublisher;
import build.buildfarm.server.services.ActionCacheService;
import build.buildfarm.server.services.CapabilitiesService;
Expand Down Expand Up @@ -109,9 +109,9 @@ public void prepareServerForGracefulShutdown() {
}
}

private ShardInstance createInstance()
private ServerInstance createInstance()
throws IOException, ConfigurationException, InterruptedException {
return new ShardInstance(
return new ServerInstance(
configs.getServer().getName(),
configs.getServer().getSession() + "-" + configs.getServer().getName(),
new DigestUtil(configs.getDigestFunction()),
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/build/buildfarm/worker/shard/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public final class Worker extends LoggingMain {
private boolean inGracefulShutdown = false;
private boolean isPaused = false;

private ShardWorkerInstance instance;
private WorkerInstance instance;

@SuppressWarnings("deprecation")
private final HealthStatusManager healthStatusManager = new HealthStatusManager();
Expand Down Expand Up @@ -532,8 +532,7 @@ public void start() throws ConfigurationException, InterruptedException, IOExcep
remoteInputStreamFactory, removeDirectoryService, accessRecorder, storage);

instance =
new ShardWorkerInstance(
configs.getWorker().getPublicName(), digestUtil, backplane, storage);
new WorkerInstance(configs.getWorker().getPublicName(), digestUtil, backplane, storage);

// Create the appropriate writer for the context
CasWriter writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import build.buildfarm.common.Write;
import build.buildfarm.common.grpc.UniformDelegateServerCallStreamObserver;
import build.buildfarm.instance.MatchListener;
import build.buildfarm.instance.server.AbstractServerInstance;
import build.buildfarm.instance.server.NodeInstance;
import build.buildfarm.operations.EnrichedOperation;
import build.buildfarm.operations.FindOperationsResults;
import build.buildfarm.v1test.BackplaneStatus;
Expand Down Expand Up @@ -68,13 +68,13 @@
import lombok.extern.java.Log;

@Log
public class ShardWorkerInstance extends AbstractServerInstance {
public class WorkerInstance extends NodeInstance {
private static final Counter IO_METRIC =
Counter.build().name("io_bytes_read").help("Read I/O (bytes)").register();

private final Backplane backplane;

public ShardWorkerInstance(
public WorkerInstance(
String name,
DigestUtil digestUtil,
Backplane backplane,
Expand Down Expand Up @@ -346,7 +346,7 @@ protected static ExecuteOperationMetadata expectExecuteOperationMetadata(Operati
return null;
}
} else {
return AbstractServerInstance.expectExecuteOperationMetadata(operation);
return NodeInstance.expectExecuteOperationMetadata(operation);
}
}

Expand Down
Loading

0 comments on commit 0967547

Please sign in to comment.