Search in sources :

Example 16 with HttpResponse

use of com.microsoft.azure.hdinsight.sdk.common.HttpResponse in project azure-tools-for-java by Microsoft.

the class SparkBatchRemoteDebugJob method createBatchSparkJobWithDriverDebugging.

/**
     * Create a batch Spark job with driver debugging enabled
     *
     * @return the current instance for chain calling
     * @throws IOException the exceptions for networking connection issues related
     * @throws DebugParameterDefinedException the exception for debug option already defined in Spark submission parameter
     */
@Override
public SparkBatchRemoteDebugJob createBatchSparkJobWithDriverDebugging() throws IOException, DebugParameterDefinedException {
    // Submit the batch job
    HttpResponse httpResponse = this.getSubmission().createBatchSparkJob(this.getConnectUri().toString(), this.getSubmissionParameter());
    // Get the batch ID from response and save it
    if (httpResponse.getCode() >= 200 && httpResponse.getCode() < 300) {
        SparkSubmitResponse jobResp = ObjectConvertUtils.convertJsonToObject(httpResponse.getMessage(), SparkSubmitResponse.class).orElseThrow(() -> new UnknownServiceException("Bad spark job response: " + httpResponse.getMessage()));
        this.setBatchId(jobResp.getId());
    }
    return this;
}
Also used : UnknownServiceException(java.net.UnknownServiceException) HttpResponse(com.microsoft.azure.hdinsight.sdk.common.HttpResponse)

Aggregations

HttpResponse (com.microsoft.azure.hdinsight.sdk.common.HttpResponse)16 Gson (com.google.gson.Gson)6 TypeToken (com.google.common.reflect.TypeToken)4 IOException (java.io.IOException)3 HDIException (com.microsoft.azure.hdinsight.sdk.common.HDIException)2 SparkSubmitResponse (com.microsoft.azure.hdinsight.spark.common.SparkSubmitResponse)2 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 PropertyChangeListener (java.beans.PropertyChangeListener)2 PropertyChangeSupport (java.beans.PropertyChangeSupport)2 UISettings (com.intellij.ide.ui.UISettings)1 UISettingsListener (com.intellij.ide.ui.UISettingsListener)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 JSchException (com.jcraft.jsch.JSchException)1 SftpException (com.jcraft.jsch.SftpException)1 SparkJobLog (com.microsoft.azure.hdinsight.spark.common.SparkJobLog)1 SparkSubmissionToolWindowView (com.microsoft.azuretools.hdinsight.SparkSubmissionToolWindowView)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1