Skip to content

Commit

Permalink
Remove staticResources from ResourceManager.
Browse files Browse the repository at this point in the history
The `staticResources` and `availableResources` are the same thing.

PiperOrigin-RevId: 458443011
Change-Id: If4bb7fe8a5bbbac372e822cedf654e0021b842b9
  • Loading branch information
Googler authored and copybara-github committed Jul 1, 2022
1 parent 804b474 commit 07db6a4
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ public static ResourceManager instance() {

private WorkerPool workerPool;

// The total amount of resources on the local host. Must be set by
// The total amount of available for Bazel resources on the local host. Must be set by
// an explicit call to setAvailableResources(), often using
// LocalHostCapacity.getLocalHostCapacity() as an argument.
private ResourceSet staticResources = null;

@VisibleForTesting public ResourceSet availableResources = null;

// Used amount of CPU capacity (where 1.0 corresponds to the one fully
Expand Down Expand Up @@ -207,7 +205,6 @@ public synchronized void resetResourceUsage() {
localRequests.clear();
dynamicWorkerRequests.clear();
dynamicStandaloneRequests.clear();
staticResources = null;
}

/**
Expand All @@ -218,12 +215,7 @@ public synchronized void resetResourceUsage() {
public synchronized void setAvailableResources(ResourceSet resources) {
Preconditions.checkNotNull(resources);
resetResourceUsage();
staticResources = resources;
availableResources =
ResourceSet.create(
staticResources.getMemoryMb(),
staticResources.getCpuUsage(),
staticResources.getLocalTestCount());
availableResources = resources;
}

/** Sets worker pool for taking the workers. Must be called before requesting the workers. */
Expand Down

0 comments on commit 07db6a4

Please sign in to comment.