Optional.empty(), failureCause, failureCause.getErrorCode(), ImmutableList.of(), ImmutableSet.of(),
Optional.empty(), failureCause, failureCause.getErrorCode(), ImmutableList.of(), ImmutableSet.of(),
private Optional<QueryFailureInfo> createQueryFailureInfo(ExecutionFailureInfo failureInfo, Optional<StageInfo> outputStage) { if (failureInfo == null) { return Optional.empty(); } Optional<TaskInfo> failedTask = outputStage.flatMap(QueryMonitor::findFailedTask); return Optional.of(new QueryFailureInfo( failureInfo.getErrorCode(), Optional.ofNullable(failureInfo.getType()), Optional.ofNullable(failureInfo.getMessage()), failedTask.map(task -> task.getTaskStatus().getTaskId().toString()), failedTask.map(task -> task.getTaskStatus().getSelf().getHost()), executionFailureInfoCodec.toJson(failureInfo))); }
failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode();
private Optional<QueryFailureInfo> createQueryFailureInfo(ExecutionFailureInfo failureInfo, Optional<StageInfo> outputStage) { if (failureInfo == null) { return Optional.empty(); } Optional<TaskInfo> failedTask = outputStage.flatMap(QueryMonitor::findFailedTask); return Optional.of(new QueryFailureInfo( failureInfo.getErrorCode(), Optional.ofNullable(failureInfo.getType()), Optional.ofNullable(failureInfo.getMessage()), failedTask.map(task -> task.getTaskStatus().getTaskId().toString()), failedTask.map(task -> task.getTaskStatus().getSelf().getHost()), executionFailureInfoCodec.toJson(failureInfo))); }
failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode();
errorCode = cause.getErrorCode();
errorCode = cause.getErrorCode();
private static Failure toException(ExecutionFailureInfo executionFailureInfo) { if (executionFailureInfo == null) { return null; } Failure failure = new Failure(executionFailureInfo.getType(), executionFailureInfo.getMessage(), executionFailureInfo.getErrorCode(), toException(executionFailureInfo.getCause())); for (ExecutionFailureInfo suppressed : executionFailureInfo.getSuppressed()) { failure.addSuppressed(toException(suppressed)); } ImmutableList.Builder<StackTraceElement> stackTraceBuilder = ImmutableList.builder(); for (String stack : executionFailureInfo.getStack()) { stackTraceBuilder.add(toStackTraceElement(stack)); } ImmutableList<StackTraceElement> stackTrace = stackTraceBuilder.build(); failure.setStackTrace(stackTrace.toArray(new StackTraceElement[stackTrace.size()])); return failure; }
private static Failure toException(ExecutionFailureInfo executionFailureInfo) { if (executionFailureInfo == null) { return null; } Failure failure = new Failure(executionFailureInfo.getType(), executionFailureInfo.getMessage(), executionFailureInfo.getErrorCode(), toException(executionFailureInfo.getCause())); for (ExecutionFailureInfo suppressed : executionFailureInfo.getSuppressed()) { failure.addSuppressed(toException(suppressed)); } ImmutableList.Builder<StackTraceElement> stackTraceBuilder = ImmutableList.builder(); for (String stack : executionFailureInfo.getStack()) { stackTraceBuilder.add(toStackTraceElement(stack)); } ImmutableList<StackTraceElement> stackTrace = stackTraceBuilder.build(); failure.setStackTrace(stackTrace.toArray(new StackTraceElement[stackTrace.size()])); return failure; }
assertEquals(failure.getSuppressed().size(), 1); assertEquals(failure.getSuppressed().get(0).getMessage(), "fake exception 2"); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getCause().getMessage(), "fake exception 1"); assertEquals(failure.getSuppressed().size(), 0); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getSuppressed().size(), 1); assertEquals(failure.getSuppressed().get(0).getMessage(), "fake exception 2"); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getCause().getMessage(), "fake exception 1"); assertEquals(failure.getSuppressed().size(), 0); assertEquals(failure.getErrorCode(), GENERIC_INTERNAL_ERROR.toErrorCode());
assertEquals(failure.getSuppressed().size(), 1); assertEquals(failure.getSuppressed().get(0).getMessage(), "fake exception 2"); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getCause().getMessage(), "fake exception 1"); assertEquals(failure.getSuppressed().size(), 0); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getSuppressed().size(), 1); assertEquals(failure.getSuppressed().get(0).getMessage(), "fake exception 2"); assertEquals(failure.getErrorCode(), TOO_MANY_REQUESTS_FAILED.toErrorCode()); assertEquals(failure.getCause().getMessage(), "fake exception 1"); assertEquals(failure.getSuppressed().size(), 0); assertEquals(failure.getErrorCode(), GENERIC_INTERNAL_ERROR.toErrorCode());
ExecutionFailureInfo failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode();
private void runTest(FailureScenario failureScenario) throws Exception { AtomicLong lastActivityNanos = new AtomicLong(System.nanoTime()); TestingTaskResource testingTaskResource = new TestingTaskResource(lastActivityNanos, failureScenario); HttpRemoteTaskFactory httpRemoteTaskFactory = createHttpRemoteTaskFactory(testingTaskResource); RemoteTask remoteTask = createRemoteTask(httpRemoteTaskFactory); testingTaskResource.setInitialTaskInfo(remoteTask.getTaskInfo()); remoteTask.start(); waitUntilIdle(lastActivityNanos); httpRemoteTaskFactory.stop(); assertTrue(remoteTask.getTaskStatus().getState().isDone(), format("TaskStatus is not in a done state: %s", remoteTask.getTaskStatus())); ErrorCode actualErrorCode = getOnlyElement(remoteTask.getTaskStatus().getFailures()).getErrorCode(); switch (failureScenario) { case TASK_MISMATCH: case TASK_MISMATCH_WHEN_VERSION_IS_HIGH: assertTrue(remoteTask.getTaskInfo().getTaskStatus().getState().isDone(), format("TaskInfo is not in a done state: %s", remoteTask.getTaskInfo())); assertEquals(actualErrorCode, REMOTE_TASK_MISMATCH.toErrorCode()); break; case REJECTED_EXECUTION: // for a rejection to occur, the http client must be shutdown, which means we will not be able to ge the final task info assertEquals(actualErrorCode, REMOTE_TASK_ERROR.toErrorCode()); break; default: throw new UnsupportedOperationException(); } }
private void runTest(FailureScenario failureScenario) throws Exception { AtomicLong lastActivityNanos = new AtomicLong(System.nanoTime()); TestingTaskResource testingTaskResource = new TestingTaskResource(lastActivityNanos, failureScenario); HttpRemoteTaskFactory httpRemoteTaskFactory = createHttpRemoteTaskFactory(testingTaskResource); RemoteTask remoteTask = createRemoteTask(httpRemoteTaskFactory); testingTaskResource.setInitialTaskInfo(remoteTask.getTaskInfo()); remoteTask.start(); waitUntilIdle(lastActivityNanos); httpRemoteTaskFactory.stop(); assertTrue(remoteTask.getTaskStatus().getState().isDone(), format("TaskStatus is not in a done state: %s", remoteTask.getTaskStatus())); ErrorCode actualErrorCode = getOnlyElement(remoteTask.getTaskStatus().getFailures()).getErrorCode(); switch (failureScenario) { case TASK_MISMATCH: case TASK_MISMATCH_WHEN_VERSION_IS_HIGH: assertTrue(remoteTask.getTaskInfo().getTaskStatus().getState().isDone(), format("TaskInfo is not in a done state: %s", remoteTask.getTaskInfo())); assertEquals(actualErrorCode, REMOTE_TASK_MISMATCH.toErrorCode()); break; case REJECTED_EXECUTION: // for a rejection to occur, the http client must be shutdown, which means we will not be able to ge the final task info assertEquals(actualErrorCode, REMOTE_TASK_ERROR.toErrorCode()); break; default: throw new UnsupportedOperationException(); } }
ExecutionFailureInfo failureCause = this.failureCause.get(); if (failureCause != null) { errorCode = failureCause.getErrorCode();