Search in sources :

Example 1 with ExecutionOptions

use of com.google.devtools.build.lib.exec.ExecutionOptions in project bazel by bazelbuild.

the class ExecutionTool method configureResourceManager.

private void configureResourceManager(BuildRequest request) {
    ResourceManager resourceMgr = ResourceManager.instance();
    ExecutionOptions options = request.getOptions(ExecutionOptions.class);
    ResourceSet resources;
    if (options.availableResources != null) {
        resources = options.availableResources;
        resourceMgr.setRamUtilizationPercentage(100);
    } else {
        resources = LocalHostCapacity.getLocalHostCapacity();
        resourceMgr.setRamUtilizationPercentage(options.ramUtilizationPercentage);
    }
    resourceMgr.setAvailableResources(ResourceSet.create(resources.getMemoryMb(), resources.getCpuUsage(), resources.getIoUsage(), request.getExecutionOptions().usingLocalTestJobs() ? request.getExecutionOptions().localTestJobs : Integer.MAX_VALUE));
}
Also used : ExecutionOptions(com.google.devtools.build.lib.exec.ExecutionOptions) ResourceManager(com.google.devtools.build.lib.actions.ResourceManager) ResourceSet(com.google.devtools.build.lib.actions.ResourceSet)

Example 2 with ExecutionOptions

use of com.google.devtools.build.lib.exec.ExecutionOptions in project bazel by bazelbuild.

the class CacheFileDigestsModule method executorInit.

@Override
public void executorInit(CommandEnvironment env, BuildRequest request, ExecutorBuilder builder) {
    super.executorInit(env, request, builder);
    ExecutionOptions options = request.getOptions(ExecutionOptions.class);
    if (lastKnownCacheSize == null || options.cacheSizeForComputedFileDigests != lastKnownCacheSize) {
        log.info("Reconfiguring cache with size=" + options.cacheSizeForComputedFileDigests);
        DigestUtils.configureCache(options.cacheSizeForComputedFileDigests);
        lastKnownCacheSize = options.cacheSizeForComputedFileDigests;
    }
    if (options.cacheSizeForComputedFileDigests == 0) {
        stats = null;
        log.info("Disabled cache");
    } else {
        stats = DigestUtils.getCacheStats();
        logStats("Accumulated cache stats before command", stats);
    }
}
Also used : ExecutionOptions(com.google.devtools.build.lib.exec.ExecutionOptions)

Aggregations

ExecutionOptions (com.google.devtools.build.lib.exec.ExecutionOptions)2 ResourceManager (com.google.devtools.build.lib.actions.ResourceManager)1 ResourceSet (com.google.devtools.build.lib.actions.ResourceSet)1