/** * Creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#RESOURCE * @return user exception builder */ public static Builder resourceError() { return resourceError(null); }
@Override public void start() { if (throwAtStart) { throw UserException.resourceError().build(logger); } }
@Override public void start() { if (throwAtStart) { ++numFailedStarts; throw UserException.resourceError().build(logger); } }
private static <T extends CompleteWork> void verify(final List<NodeEndpoint> endpoints, final List<T> units, final boolean condition, final String msg, Object... args) { if (!condition) { throw UserException.resourceError() .message(msg, args) .addContext("endpoints %s", endpoints) .addContext("workunits %s", units) .build(logger); } } }
continue; throw UserException.resourceError(e) .addContext("Server", rpcConfig.getName()) .message("Could not bind to port %s.", port)
"Total runnable size %d, parallelism %d.", timeout, activity, runnables.size(), parallelism); logger.error(errMsg); throw UserException.resourceError() .message(errMsg) .build(logger);
public static PlanningSet getParallelizationInfo( final QueryContext queryContext, AttemptObserver observer, final PhysicalPlan plan, final Collection<NodeEndpoint> activeEndpoints) throws ExecutionSetupException { // step one, check to make sure that there available execution nodes. if(activeEndpoints.isEmpty()){ throw UserException.resourceError().message("No executors currently available.").build(logger); } final Root rootOperator = plan.getRoot(); final Fragment rootFragment = rootOperator.accept(MakeFragmentsVisitor.INSTANCE, null); final SimpleParallelizer parallelizer = new SimpleParallelizer(queryContext, observer, activeEndpoints); observer.planParallelStart(); final Stopwatch stopwatch = Stopwatch.createStarted(); final PlanningSet planningSet = parallelizer.getFragmentsHelper(activeEndpoints, rootFragment); observer.planParallelized(planningSet); stopwatch.stop(); return planningSet; }
throw UserException.resourceError() .message("Query was cancelled because the initial memory requirement (%s) is greater than the job memory limit set by the administrator (%s)", PrettyPrintUtils.bytePrint(outsideReserve + consideredOpsReserve, true),
@Override public List<EndpointAffinity> getAffinity() { if(split.getAffinitiesList() == null){ return ImmutableList.<EndpointAffinity>of(); } List<EndpointAffinity> endpoints = new ArrayList<>(); for(Affinity a : split.getAffinitiesList()){ NodeEndpoint endpoint = nodeMap.getEndpoint(a.getHost()); if(endpoint != null){ endpoints.add(new EndpointAffinity(endpoint, a.getFactor(), affinityType == DistributionAffinity.HARD, affinityType == DistributionAffinity.HARD ? 1 : Integer.MAX_VALUE)); } else { if (affinityType == DistributionAffinity.HARD) { // Throw an error if there is no endpoint on host throw UserException.resourceError() .message("No executors are available for data with hard affinity. " + "You may consider using \"registration.publish-host\" property if your network rules change.") .addContext("available executors %s", nodeMap.getHosts()) .addContext("data affinity", a.getHost()) .build(logger); } } } return endpoints; }
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public SourceUI putSource(SourceUI source) throws NamespaceException, UserNotFoundException, SourceNotFoundException { try { //Following are set at server side. source.setName(sourceName.getName()); source.setCtime(System.currentTimeMillis()); SourceConfig sourceConfig = sourceService.registerSourceWithRuntime(source); final SourceState sourceState = sourceService.getSourceState(sourcePath.getSourceName().getName()); if (sourceState == null) { throw new SourceNotFoundException(sourcePath.getSourceName().getName()); } source.setState(sourceState); source.setTag(sourceConfig.getTag()); source.setId(sourceConfig.getId().getId()); return source; } catch (ExecutionSetupException e) { // if we are getting an ExecutionSetupException it will most likely contain a "useful" error message throw UserExceptionMapper.withStatus(UserException.resourceError(e), Response.Status.INTERNAL_SERVER_ERROR) .message("Failure while attempting to register source: %s", e.getMessage()) .build(logger); } } }
partitionSpillFileStream = partitionSpillFile.create(); } catch (Exception e) { final UserException.Builder builder = UserException.resourceError(e) .addContext("Failed to create output stream for spill file") .addContext("Spill file path:", partitionSpillFile.getPath());
public QueryResult toQueryResult() { if (result == null) { QueryResult.Builder resultBuilder = QueryResult.newBuilder() .setQueryId(queryId) .setQueryState(state); if (exception != null) { resultBuilder.addError(exception.getOrCreatePBError(true)); } if (state == QueryState.CANCELED && !clientCancelled) { // from client POV, CANCELED becomes FAILED only if server caused the cancellation resultBuilder.setQueryState(QueryState.FAILED); resultBuilder.addError(UserException.resourceError() .message(cancelReason) .build(logger) .getOrCreatePBError(true)); } result = resultBuilder.build(); } return result; }
throw UserException.resourceError().message("No executors currently available.").build(logger);