Search in sources :

Example 1 with ExceptionUtils.getRootCauseMessage

use of org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage in project backend by CatalogueOfLife.

the class SectorRunnable method run.

@Override
public void run() {
    LoggingUtils.setSectorMDC(sectorKey, state.getAttempt(), getClass());
    boolean failed = true;
    try {
        state.setStarted(LocalDateTime.now());
        state.setState(ImportState.PREPARING);
        LOG.info("Start {} for sector {}", this.getClass().getSimpleName(), sectorKey);
        init();
        doWork();
        state.setState(ImportState.ANALYZING);
        LOG.info("Build metrics for sector {}", sectorKey);
        doMetrics();
        state.setState(ImportState.INDEXING);
        LOG.info("Update search index for sector {}", sectorKey);
        updateSearchIndex();
        state.setState(ImportState.FINISHED);
        LOG.info("Completed {} for sector {}", this.getClass().getSimpleName(), sectorKey);
        failed = false;
        successCallback.accept(this);
    } catch (InterruptedException e) {
        LOG.warn("Interrupted {}", this, e);
        state.setState(ImportState.CANCELED);
        errorCallback.accept(this, e);
    } catch (Exception e) {
        LOG.error("Failed {}", this, e);
        state.setError(ExceptionUtils.getRootCauseMessage(e));
        state.setState(ImportState.FAILED);
        errorCallback.accept(this, e);
    } finally {
        state.setFinished(LocalDateTime.now());
        // persist sector import
        try (SqlSession session = factory.openSession(true)) {
            session.getMapper(SectorImportMapper.class).update(state);
            // update sector with latest attempt on success only for true syncs
            if (!failed && this instanceof SectorSync) {
                session.getMapper(SectorMapper.class).updateLastSync(sectorKey, state.getAttempt());
            }
        }
        LoggingUtils.removeSectorMDC();
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) NotImplementedException(org.apache.commons.lang3.NotImplementedException) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) NotFoundException(life.catalogue.api.exception.NotFoundException)

Example 2 with ExceptionUtils.getRootCauseMessage

use of org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage in project spring-cloud-dataflow by spring-cloud.

the class MetricsReplicationEnvironmentPostProcessor method postProcessEnvironment.

@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
    try {
        // Disable (only for this processor) the failures on unresolved placeholders.
        environment.setIgnoreUnresolvableNestedPlaceholders(true);
        Properties additionalProperties = new Properties();
        // 1. Infer the Monitoring Dashboard properties from the server's metrics configuration properties.
        this.inferMonitoringDashboardProperties(environment, additionalProperties);
        // and applicationProperties.task.
        if (environment.getProperty(MONITORING_PREFIX + ".property-replication", Boolean.class, true)) {
            // Callback function that checks if the input property is set the server's configuration. If it is then
            // the property is replicated as a common Stream and Task property.
            Consumer<String> propertyReplicator = metricsPropertyName -> {
                if (environment.containsProperty(metricsPropertyName)) {
                    try {
                        String serverPropertyValue = environment.getProperty(metricsPropertyName);
                        // Overrides only the Stream applicationProperties that have not been set explicitly.
                        String commonStreamPropertyName = COMMON_APPLICATION_PREFIX + ".stream." + metricsPropertyName;
                        if (!environment.containsProperty(commonStreamPropertyName)) {
                            logger.info("Replicate metrics property:" + commonStreamPropertyName + "=" + serverPropertyValue);
                            // if a property with same key occurs multiple times only the first is set.
                            additionalProperties.putIfAbsent(commonStreamPropertyName, serverPropertyValue);
                        }
                        // Overrides only the Task applicationProperties that have not been set explicitly.
                        String commonTaskPropertyName = COMMON_APPLICATION_PREFIX + ".task." + metricsPropertyName;
                        if (!environment.containsProperty(commonTaskPropertyName)) {
                            logger.info("Replicate metrics property:" + commonTaskPropertyName + "=" + serverPropertyValue);
                            // if a property with same key occurs multiple times only the first is set.
                            additionalProperties.putIfAbsent(commonTaskPropertyName, serverPropertyValue);
                        }
                    } catch (Throwable throwable) {
                        logger.error("Failed with replicating {}, because of {}", metricsPropertyName, ExceptionUtils.getRootCauseMessage(throwable));
                    }
                }
            };
            this.replicateServerMetricsPropertiesToStreamAndTask(environment, WavefrontProperties.class, propertyReplicator);
            this.replicateServerMetricsPropertiesToStreamAndTask(environment, InfluxProperties.class, propertyReplicator);
            this.replicateServerMetricsPropertiesToStreamAndTask(environment, PrometheusProperties.class, propertyReplicator);
            this.replicateServerMetricsPropertiesToStreamAndTask(environment, PrometheusRSocketClientProperties.class, propertyReplicator);
        }
        // This post-processor is called multiple times but sets the properties only once.
        if (!additionalProperties.isEmpty()) {
            PropertiesPropertySource propertiesPropertySource = new PropertiesPropertySource(PROPERTY_SOURCE_KEY_NAME, additionalProperties);
            environment.getPropertySources().addLast(propertiesPropertySource);
        }
    } finally {
        environment.setIgnoreUnresolvableNestedPlaceholders(false);
    }
}
Also used : Ordered(org.springframework.core.Ordered) Properties(java.util.Properties) Logger(org.slf4j.Logger) InfluxProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.influx.InfluxProperties) LoggerFactory(org.slf4j.LoggerFactory) PropertiesPropertySource(org.springframework.core.env.PropertiesPropertySource) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) Field(java.lang.reflect.Field) WavefrontProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.wavefront.WavefrontProperties) Consumer(java.util.function.Consumer) SpringApplication(org.springframework.boot.SpringApplication) ConfigurableEnvironment(org.springframework.core.env.ConfigurableEnvironment) MonitoringDashboardType(org.springframework.cloud.dataflow.rest.resource.about.MonitoringDashboardType) CommonApplicationProperties(org.springframework.cloud.dataflow.server.config.apps.CommonApplicationProperties) Modifier(java.lang.reflect.Modifier) PrometheusProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties) PrometheusRSocketClientProperties(io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketClientProperties) EnvironmentPostProcessor(org.springframework.boot.env.EnvironmentPostProcessor) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) RelaxedNames(org.springframework.cloud.dataflow.core.RelaxedNames) StringUtils(org.springframework.util.StringUtils) PropertiesPropertySource(org.springframework.core.env.PropertiesPropertySource) Properties(java.util.Properties) InfluxProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.influx.InfluxProperties) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) WavefrontProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.wavefront.WavefrontProperties) CommonApplicationProperties(org.springframework.cloud.dataflow.server.config.apps.CommonApplicationProperties) PrometheusProperties(org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties) PrometheusRSocketClientProperties(io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketClientProperties)

Example 3 with ExceptionUtils.getRootCauseMessage

use of org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage in project build-info by jfrog.

the class GoDependencyTree method createDependencyTree.

/**
 * Create Go dependency tree of actually used dependencies.
 *
 * @param goDriver - Go driver
 * @param logger   - The logger
 * @param verbose  - verbose logging
 * @return Go dependency tree
 * @throws IOException in case of any I/O error.
 */
public static DependencyTree createDependencyTree(GoDriver goDriver, Log logger, boolean verbose) throws IOException {
    // Run go mod graph.
    CommandResults goGraphResult = goDriver.modGraph(verbose);
    String[] dependenciesGraph = goGraphResult.getRes().split("\\r?\\n");
    // Run go list -f "{{with .Module}}{{.Path}} {{.Version}}{{end}}" all
    CommandResults usedModulesResults;
    try {
        usedModulesResults = goDriver.getUsedModules(false, false);
    } catch (IOException e) {
        // Errors occurred during running "go list". Run again and this time ignore errors.
        usedModulesResults = goDriver.getUsedModules(false, true);
        logger.warn("Errors occurred during building the Go dependency tree. The dependency tree may be incomplete:" + System.lineSeparator() + ExceptionUtils.getRootCauseMessage(e));
    }
    Set<String> usedDependencies = Arrays.stream(usedModulesResults.getRes().split("\\r?\\n")).map(String::trim).map(usedModule -> usedModule.replace(" ", "@")).collect(Collectors.toSet());
    // Create root node.
    String rootPackageName = goDriver.getModuleName();
    DependencyTree rootNode = new DependencyTree(rootPackageName);
    rootNode.setMetadata(true);
    // Build dependency tree.
    Map<String, List<String>> dependenciesMap = new HashMap<>();
    populateDependenciesMap(dependenciesGraph, usedDependencies, dependenciesMap);
    populateDependencyTree(rootNode, rootPackageName, dependenciesMap, logger);
    return rootNode;
}
Also used : Log(org.jfrog.build.api.util.Log) java.util(java.util) DependencyTree(org.jfrog.build.extractor.scan.DependencyTree) IOException(java.io.IOException) StringUtils(org.apache.commons.lang3.StringUtils) CommandResults(org.jfrog.build.extractor.executor.CommandResults) Collectors(java.util.stream.Collectors) GoDriver(org.jfrog.build.extractor.go.GoDriver) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) DependencyTree(org.jfrog.build.extractor.scan.DependencyTree) IOException(java.io.IOException) CommandResults(org.jfrog.build.extractor.executor.CommandResults)

Example 4 with ExceptionUtils.getRootCauseMessage

use of org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage in project pulsar by yahoo.

the class ManagedLedgerTest method testConcurrentOpenCursorShouldNotHaveConcurrentAccessOfUninitializedCursors.

@Test
public void testConcurrentOpenCursorShouldNotHaveConcurrentAccessOfUninitializedCursors() throws Exception {
    ManagedLedgerImpl ledger = (ManagedLedgerImpl) factory.open("ConcurrentAccessOfUninitializedCursors");
    final CompletableFuture<ManagedCursor> cursorFuture = new CompletableFuture<>();
    final CompletableFuture<Void> removingFuture = new CompletableFuture<>();
    final CompletableFuture<Void> concurrentAccessFuture = new CompletableFuture<>();
    final Throwable concurrentAccessTimeout = new TimeoutException();
    cachedExecutor.execute(() -> {
        removingFuture.join();
        CompletableFuture<Void> lockingFuture = new CompletableFuture<>();
        cachedExecutor.execute(() -> {
            try {
                lockingFuture.join();
                // Gives `synchronized (ledger)` a chance to complete if it got lock immediately.
                Thread.sleep(2);
                // Normally, following code will process after success or failure contention of
                // `synchronized (ledger)`. Theoretically, it is possible that following code
                // complete before contention of `synchronized (ledger)` block, but it is rare
                // in practice, and it is not harmful as it produces only false positive cases.
                concurrentAccessFuture.completeExceptionally(concurrentAccessTimeout);
            } catch (InterruptedException ex) {
                Thread.currentThread().interrupt();
            }
        });
        lockingFuture.complete(null);
        synchronized (ledger) {
            concurrentAccessFuture.complete(null);
        }
    });
    Map<String, CompletableFuture<ManagedCursor>> uninitializedCursors = ledger.uninitializedCursors;
    Map<String, CompletableFuture<ManagedCursor>> spyUninitializedCursors = spy(uninitializedCursors);
    doAnswer(mock -> {
        removingFuture.complete(null);
        try {
            // Access of uninitializedCursors should guarded by synchronized(ledger),
            // so there are must be no concurrent accesses in this scope. If we get this
            // future successfully, then there is a concurrent access.
            concurrentAccessFuture.get();
            Throwable throwable = new IllegalStateException("Detecting concurrent access of uninitializedCursors");
            cursorFuture.completeExceptionally(throwable);
        } catch (Exception ex) {
            assertSame(ExceptionUtils.getRootCause(ex), concurrentAccessTimeout);
        }
        return mock.callRealMethod();
    }).when(spyUninitializedCursors).remove(anyString());
    setFieldValue(ManagedLedgerImpl.class, ledger, "uninitializedCursors", spyUninitializedCursors);
    cachedExecutor.execute(() -> {
        try {
            ledger.asyncOpenCursor("c1", new OpenCursorCallback() {

                @Override
                public void openCursorFailed(ManagedLedgerException exception, Object ctx) {
                    cursorFuture.completeExceptionally(exception);
                }

                @Override
                public void openCursorComplete(ManagedCursor cursor, Object ctx) {
                    cursorFuture.complete(cursor);
                }
            }, null);
        } catch (Exception e) {
            cursorFuture.completeExceptionally(e);
        }
    });
    try {
        ManagedCursor cursor = cursorFuture.get();
        assertNotNull(cursor);
    } catch (Exception ex) {
        fail(ExceptionUtils.getRootCauseMessage(ex));
    } finally {
        ledger.close();
    }
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) GeneralSecurityException(java.security.GeneralSecurityException) MetadataStoreException(org.apache.pulsar.metadata.api.MetadataStoreException) ManagedLedgerFencedException(org.apache.bookkeeper.mledger.ManagedLedgerException.ManagedLedgerFencedException) ManagedLedgerNotFoundException(org.apache.bookkeeper.mledger.ManagedLedgerException.ManagedLedgerNotFoundException) ReadOnlyBufferException(java.nio.ReadOnlyBufferException) TimeoutException(java.util.concurrent.TimeoutException) BKException(org.apache.bookkeeper.client.BKException) ManagedLedgerException(org.apache.bookkeeper.mledger.ManagedLedgerException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) MetaStoreException(org.apache.bookkeeper.mledger.ManagedLedgerException.MetaStoreException) ManagedCursor(org.apache.bookkeeper.mledger.ManagedCursor) CompletableFuture(java.util.concurrent.CompletableFuture) OpenCursorCallback(org.apache.bookkeeper.mledger.AsyncCallbacks.OpenCursorCallback) ManagedLedgerException(org.apache.bookkeeper.mledger.ManagedLedgerException) MutableObject(org.apache.commons.lang3.mutable.MutableObject) TimeoutException(java.util.concurrent.TimeoutException) Test(org.testng.annotations.Test)

Example 5 with ExceptionUtils.getRootCauseMessage

use of org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage in project azure-tools-for-java by Microsoft.

the class SparkBatchJobDebuggerRunner method execute.

/**
 * Execute Spark remote debugging action, refer to {@link GenericDebuggerRunner#execute(ExecutionEnvironment)}
 * implementations, some internal API leveraged.
 *
 * @param environment the execution environment
 * @throws ExecutionException the exception in execution
 */
@Override
public void execute(final ExecutionEnvironment environment) throws ExecutionException {
    final RunProfileState state = environment.getState();
    if (state == null) {
        return;
    }
    final Operation operation = environment.getUserData(TelemetryKeys.OPERATION);
    final AsyncPromise<ExecutionEnvironment> jobDriverEnvReady = new AsyncPromise<>();
    final SparkBatchRemoteDebugState submissionState = (SparkBatchRemoteDebugState) state;
    final SparkSubmitModel submitModel = submissionState.getSubmitModel();
    // Create SSH debug session firstly
    final SparkBatchDebugSession session;
    try {
        session = SparkBatchDebugSession.factoryByAuth(getSparkJobUrl(submitModel), submitModel.getAdvancedConfigModel()).open().verifyCertificate();
    } catch (final Exception e) {
        final ExecutionException exp = new ExecutionException("Failed to create SSH session for debugging. " + ExceptionUtils.getRootCauseMessage(e));
        EventUtil.logErrorClassNameOnlyWithComplete(operation, ErrorType.systemError, exp, null, null);
        throw exp;
    }
    final Project project = submitModel.getProject();
    final ExecutionManager executionManager = ExecutionManager.getInstance(project);
    final IdeaSchedulers schedulers = new IdeaSchedulers(project);
    final PublishSubject<SparkBatchJobSubmissionEvent> debugEventSubject = PublishSubject.create();
    final ISparkBatchDebugJob sparkDebugBatch = (ISparkBatchDebugJob) submissionState.getSparkBatch().clone();
    final PublishSubject<SparkLogLine> ctrlSubject = (PublishSubject<SparkLogLine>) sparkDebugBatch.getCtrlSubject();
    final SparkBatchJobRemoteDebugProcess driverDebugProcess = new SparkBatchJobRemoteDebugProcess(schedulers, session, sparkDebugBatch, submitModel.getArtifactPath().orElseThrow(() -> new ExecutionException("No artifact selected")), submitModel.getSubmissionParameter().getMainClassName(), submitModel.getAdvancedConfigModel(), ctrlSubject);
    final SparkBatchJobDebugProcessHandler driverDebugHandler = new SparkBatchJobDebugProcessHandler(project, driverDebugProcess, debugEventSubject);
    // Prepare an independent submission console
    final ConsoleViewImpl submissionConsole = new ConsoleViewImpl(project, true);
    final RunContentDescriptor submissionDesc = new RunContentDescriptor(submissionConsole, driverDebugHandler, submissionConsole.getComponent(), String.format("Submit %s to cluster %s", submitModel.getSubmissionParameter().getMainClassName(), submitModel.getSubmissionParameter().getClusterName()));
    // Show the submission console view
    ExecutionManager.getInstance(project).getContentManager().showRunContent(environment.getExecutor(), submissionDesc);
    // Use the submission console to display the deployment ctrl message
    final Subscription jobSubscription = ctrlSubject.subscribe(typedMessage -> {
        final String line = typedMessage.getRawLog() + "\n";
        switch(typedMessage.getMessageInfoType()) {
            case Error:
                submissionConsole.print(line, ConsoleViewContentType.ERROR_OUTPUT);
                break;
            case Info:
                submissionConsole.print(line, ConsoleViewContentType.NORMAL_OUTPUT);
                break;
            case Log:
                submissionConsole.print(line, ConsoleViewContentType.SYSTEM_OUTPUT);
                break;
            case Warning:
                submissionConsole.print(line, ConsoleViewContentType.LOG_WARNING_OUTPUT);
                break;
        }
    }, err -> {
        submissionConsole.print(ExceptionUtils.getRootCauseMessage(err), ConsoleViewContentType.ERROR_OUTPUT);
        final String errMsg = "The Spark job remote debug is cancelled due to " + ExceptionUtils.getRootCauseMessage(err);
        jobDriverEnvReady.setError(errMsg);
        EventUtil.logErrorClassNameOnlyWithComplete(operation, ErrorType.systemError, new UncheckedExecutionException(errMsg, err), null, null);
    }, () -> {
        if (Optional.ofNullable(driverDebugHandler.getUserData(ProcessHandler.TERMINATION_REQUESTED)).orElse(false)) {
            final String errMsg = "The Spark job remote debug is cancelled by user.";
            jobDriverEnvReady.setError(errMsg);
            final Map<String, String> props = ImmutableMap.of("isDebugCancelled", "true");
            EventUtil.logErrorClassNameOnlyWithComplete(operation, ErrorType.userError, new ExecutionException(errMsg), props, null);
        }
    });
    // Call after completed or error
    debugEventSubject.subscribeOn(Schedulers.io()).doAfterTerminate(session::close).subscribe(debugEvent -> {
        try {
            if (debugEvent instanceof SparkBatchRemoteDebugHandlerReadyEvent) {
                final SparkBatchRemoteDebugHandlerReadyEvent handlerReadyEvent = (SparkBatchRemoteDebugHandlerReadyEvent) debugEvent;
                final SparkBatchDebugJobJdbPortForwardedEvent jdbReadyEvent = handlerReadyEvent.getJdbPortForwardedEvent();
                if (!jdbReadyEvent.getLocalJdbForwardedPort().isPresent()) {
                    return;
                }
                final int localPort = jdbReadyEvent.getLocalJdbForwardedPort().get();
                final ExecutionEnvironment forkEnv = forkEnvironment(environment, jdbReadyEvent.getRemoteHost().orElse("unknown"), jdbReadyEvent.isDriver());
                final RunProfile runProfile = forkEnv.getRunProfile();
                if (!(runProfile instanceof LivySparkBatchJobRunConfiguration)) {
                    ctrlSubject.onError(new UnsupportedOperationException("Only supports LivySparkBatchJobRunConfiguration type, but got type" + runProfile.getClass().getCanonicalName()));
                    return;
                }
                // Reuse the driver's Spark batch job
                ((LivySparkBatchJobRunConfiguration) runProfile).setSparkRemoteBatch(sparkDebugBatch);
                final SparkBatchRemoteDebugState forkState = jdbReadyEvent.isDriver() ? submissionState : (SparkBatchRemoteDebugState) forkEnv.getState();
                if (forkState == null) {
                    return;
                }
                // Set the debug connection to localhost and local forwarded port to the state
                forkState.setRemoteConnection(new RemoteConnection(true, "localhost", Integer.toString(localPort), false));
                // Prepare the debug tab console view UI
                SparkJobLogConsoleView jobOutputView = new SparkJobLogConsoleView(project);
                // Get YARN container log URL port
                int containerLogUrlPort = ((SparkBatchRemoteDebugJob) driverDebugProcess.getSparkJob()).getYarnContainerLogUrlPort().toBlocking().single();
                // Parse container ID and host URL from driver console view
                jobOutputView.getSecondaryConsoleView().addMessageFilter((line, entireLength) -> {
                    Matcher matcher = Pattern.compile("Launching container (\\w+).* on host ([a-zA-Z_0-9-.]+)", Pattern.CASE_INSENSITIVE).matcher(line);
                    while (matcher.find()) {
                        String containerId = matcher.group(1);
                        // TODO: get port from somewhere else rather than hard code here
                        URI hostUri = URI.create(String.format("http://%s:%d", matcher.group(2), containerLogUrlPort));
                        debugEventSubject.onNext(new SparkBatchJobExecutorCreatedEvent(hostUri, containerId));
                    }
                    return null;
                });
                jobOutputView.attachToProcess(handlerReadyEvent.getDebugProcessHandler());
                ExecutionResult result = new DefaultExecutionResult(jobOutputView, handlerReadyEvent.getDebugProcessHandler());
                forkState.setExecutionResult(result);
                forkState.setConsoleView(jobOutputView.getSecondaryConsoleView());
                forkState.setRemoteProcessCtrlLogHandler(handlerReadyEvent.getDebugProcessHandler());
                if (jdbReadyEvent.isDriver()) {
                    // Let the debug console view to handle the control log
                    jobSubscription.unsubscribe();
                    // Resolve job driver promise, handle the driver VM attaching separately
                    jobDriverEnvReady.setResult(forkEnv);
                } else {
                    // Start Executor debugging
                    executionManager.startRunProfile(forkEnv, () -> toIdeaPromise(attachAndDebug(forkEnv, forkState)));
                }
            } else if (debugEvent instanceof SparkBatchJobExecutorCreatedEvent) {
                SparkBatchJobExecutorCreatedEvent executorCreatedEvent = (SparkBatchJobExecutorCreatedEvent) debugEvent;
                final String containerId = executorCreatedEvent.getContainerId();
                final SparkBatchRemoteDebugJob debugJob = (SparkBatchRemoteDebugJob) driverDebugProcess.getSparkJob();
                URI internalHostUri = executorCreatedEvent.getHostUri();
                URI executorLogUrl = debugJob.convertToPublicLogUri(internalHostUri).map(uri -> uri.resolve(String.format("node/containerlogs/%s/livy", containerId))).toBlocking().singleOrDefault(internalHostUri);
                // Create an Executor Debug Process
                SparkBatchJobRemoteDebugExecutorProcess executorDebugProcess = new SparkBatchJobRemoteDebugExecutorProcess(schedulers, debugJob, internalHostUri.getHost(), driverDebugProcess.getDebugSession(), executorLogUrl.toString());
                SparkBatchJobDebugProcessHandler executorDebugHandler = new SparkBatchJobDebugProcessHandler(project, executorDebugProcess, debugEventSubject);
                executorDebugHandler.getRemoteDebugProcess().start();
            }
        } catch (final ExecutionException e) {
            EventUtil.logErrorClassNameOnlyWithComplete(operation, ErrorType.systemError, new UncheckedExecutionException(e), null, null);
            throw new UncheckedExecutionException(e);
        }
    });
    driverDebugHandler.getRemoteDebugProcess().start();
    // Driver side execute, leverage Intellij Async Promise, to wait for the Spark app deployed
    executionManager.startRunProfile(environment, () -> jobDriverEnvReady.thenAsync(driverEnv -> toIdeaPromise(attachAndDebug(driverEnv, state))));
}
Also used : ModalityState.any(com.intellij.openapi.application.ModalityState.any) ExecutionManager(com.intellij.execution.ExecutionManager) ModalityState(com.intellij.openapi.application.ModalityState) SparkJobLogConsoleView(com.microsoft.azure.hdinsight.spark.ui.SparkJobLogConsoleView) com.intellij.execution.configurations(com.intellij.execution.configurations) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) Matcher(java.util.regex.Matcher) ConsoleViewContentType(com.intellij.execution.ui.ConsoleViewContentType) ClusterManagerEx(com.microsoft.azure.hdinsight.common.ClusterManagerEx) Map(java.util.Map) Schedulers(rx.schedulers.Schedulers) ExecutionResult(com.intellij.execution.ExecutionResult) URI(java.net.URI) Nullable(com.microsoft.azuretools.azurecommons.helpers.Nullable) ImmutableMap(com.google.common.collect.ImmutableMap) WindowManager(com.intellij.openapi.wm.WindowManager) ErrorType(com.microsoft.azuretools.telemetrywrapper.ErrorType) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) ExecutionEnvironmentBuilder(com.intellij.execution.runners.ExecutionEnvironmentBuilder) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) GenericDebuggerRunnerSettings(com.intellij.debugger.impl.GenericDebuggerRunnerSettings) RxJavaExtKt.toIdeaPromise(com.microsoft.intellij.rxjava.RxJavaExtKt.toIdeaPromise) Optional(java.util.Optional) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) Pattern(java.util.regex.Pattern) Subscription(rx.Subscription) PublishSubject(rx.subjects.PublishSubject) com.microsoft.azure.hdinsight.spark.common(com.microsoft.azure.hdinsight.spark.common) GenericDebuggerRunner(com.intellij.debugger.impl.GenericDebuggerRunner) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) AsyncPromise(org.jetbrains.concurrency.AsyncPromise) TelemetryKeys(com.microsoft.intellij.telemetry.TelemetryKeys) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull) ExecutionException(com.intellij.execution.ExecutionException) LivyCluster(com.microsoft.azure.hdinsight.sdk.cluster.LivyCluster) IdeaSchedulers(com.microsoft.intellij.rxjava.IdeaSchedulers) Observable(rx.Observable) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) SparkBatchSubmission.getClusterSubmission(com.microsoft.azure.hdinsight.spark.common.SparkBatchSubmission.getClusterSubmission) Project(com.intellij.openapi.project.Project) LivySparkBatchJobRunConfiguration(com.microsoft.azure.hdinsight.spark.run.configuration.LivySparkBatchJobRunConfiguration) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) ConsoleViewImpl(com.intellij.execution.impl.ConsoleViewImpl) Key(com.intellij.openapi.util.Key) IOException(java.io.IOException) ProcessHandler(com.intellij.execution.process.ProcessHandler) ModalityState.stateForComponent(com.intellij.openapi.application.ModalityState.stateForComponent) SparkLogLine(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine) SparkSubmissionAdvancedConfigPanel(com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionAdvancedConfigPanel) javax.swing(javax.swing) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) Matcher(java.util.regex.Matcher) IdeaSchedulers(com.microsoft.intellij.rxjava.IdeaSchedulers) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) AsyncPromise(org.jetbrains.concurrency.AsyncPromise) LivySparkBatchJobRunConfiguration(com.microsoft.azure.hdinsight.spark.run.configuration.LivySparkBatchJobRunConfiguration) URI(java.net.URI) ConsoleViewImpl(com.intellij.execution.impl.ConsoleViewImpl) PublishSubject(rx.subjects.PublishSubject) ExecutionException(com.intellij.execution.ExecutionException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) Subscription(rx.Subscription) SparkJobLogConsoleView(com.microsoft.azure.hdinsight.spark.ui.SparkJobLogConsoleView) ExecutionManager(com.intellij.execution.ExecutionManager) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) ExecutionResult(com.intellij.execution.ExecutionResult) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ExecutionException(com.intellij.execution.ExecutionException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) IOException(java.io.IOException) Project(com.intellij.openapi.project.Project) SparkLogLine(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine)

Aggregations

ExceptionUtils (org.apache.commons.lang3.exception.ExceptionUtils)17 List (java.util.List)12 ArrayList (java.util.ArrayList)9 Collectors (java.util.stream.Collectors)9 Project (de.tudarmstadt.ukp.clarin.webanno.model.Project)8 IOException (java.io.IOException)7 StringUtils (org.apache.commons.lang3.StringUtils)6 ChallengeResponseDialog (de.tudarmstadt.ukp.clarin.webanno.support.dialog.ChallengeResponseDialog)5 LambdaAjaxLink (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink)5 LambdaBehavior.visibleWhen (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaBehavior.visibleWhen)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 IFeedback (org.apache.wicket.feedback.IFeedback)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 Label (org.apache.wicket.markup.html.basic.Label)5 IModel (org.apache.wicket.model.IModel)5 Model (org.apache.wicket.model.Model)5 PropertyModel (org.apache.wicket.model.PropertyModel)5 StringResourceModel (org.apache.wicket.model.StringResourceModel)5 SpringBean (org.apache.wicket.spring.injection.annot.SpringBean)5 BootstrapRadioChoice (de.agilecoders.wicket.core.markup.html.bootstrap.form.BootstrapRadioChoice)4