private void init() throws InterruptedException { EvaluationResult<SkyValue> result; try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", LOG)) { result = graphFactory.prepareAndGet( universeScope, parserPrefix, loadingPhaseThreads, eventHandler); } graph = result.getWalkableGraph(); SkyKey universeKey = graphFactory.getUniverseKey(universeScope, parserPrefix); universeTargetPatternKeys = PrepareDepsOfPatternsFunction.getTargetPatternKeys( PrepareDepsOfPatternsFunction.getSkyKeys(universeKey, eventHandler)); // The prepareAndGet call above evaluates a single PrepareDepsOfPatterns SkyKey. // We expect to see either a single successfully evaluated value or a cycle in the result. Collection<SkyValue> values = result.values(); if (!values.isEmpty()) { Preconditions.checkState( values.size() == 1, "Universe query \"%s\" returned multiple" + " values unexpectedly (%s values in result)", universeScope, values.size()); Preconditions.checkNotNull(result.get(universeKey), result); } else { // No values in the result, so there must be an error. We expect the error to be a cycle. boolean foundCycle = !Iterables.isEmpty(result.getError().getCycleInfo()); Preconditions.checkState( foundCycle, "Universe query \"%s\" failed with non-cycle error: %s", universeScope, result.getError()); } }
private List<Action> evaluate(SpawnActionTemplate spawnActionTemplate) throws Exception { SkyKey skyKey = ActionTemplateExpansionValue.key(spawnActionTemplate); EvaluationResult<ActionTemplateExpansionValue> result = driver.evaluate( ImmutableList.of(skyKey), false, SkyframeExecutor.DEFAULT_THREAD_COUNT, NullEventHandler.INSTANCE); if (result.hasError()) { throw result.getError().getException(); } return ImmutableList.copyOf(result.get(skyKey).getExpandedActions()); }