Search in sources :

Example 1 with SparkSubmitModel

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

the class SparkBatchJobConfigurable method setData.

@Override
public void setData(@NotNull SparkBatchJobConfigurableModel data) {
    // Data -> Component
    localRunParamsPanel.setData(data.getLocalRunConfigurableModel());
    SparkSubmitModel submitModel = data.getSubmitModel();
    submitModel.setClusterSelectable(data.isClusterSelectionEnabled());
    submissionContentPanel.setData(data.getSubmitModel());
    executionTypeTabPane.setSelectedIndex(data.getFocusedTabIndex());
    commonRunParametersPanel.setMainClassName(data.getSubmitModel().getMainClassName());
    // Presentation only
    setLocalRunConfigEnabled(data.isLocalRunConfigEnabled());
}
Also used : SparkSubmitModel(com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel)

Example 2 with SparkSubmitModel

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

the class RemoteDebugRunConfiguration method readExternal.

@Override
public void readExternal(Element rootElement) throws InvalidDataException {
    super.readExternal(rootElement);
    SparkSubmitModel model = getSubmitModel();
    SparkSubmissionParameter parameter = Optional.ofNullable(model.getSubmissionParameter()).orElse(new SparkSubmissionParameter("", false, "", "", "", "", new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), Arrays.stream(SparkSubmissionParameter.defaultParameters).collect(Collectors.toMap(Pair::first, Pair::second))));
    Optional.ofNullable(rootElement.getChild(SUBMISSION_CONTENT_NAME)).ifPresent((element -> {
        Optional.ofNullable(element.getAttribute(SUBMISSION_ATTRIBUTE_CLUSTER_NAME)).ifPresent(attribute -> parameter.setClusterName(attribute.getValue()));
        Optional.ofNullable(element.getAttribute(SUBMISSION_ATTRIBUTE_IS_LOCAL_ARTIFACT)).ifPresent(attribute -> parameter.setLocalArtifact(attribute.getValue().toLowerCase().equals("true")));
        Optional.ofNullable(element.getAttribute(SUBMISSION_ATTRIBUTE_ARTIFACT_NAME)).ifPresent(attribute -> parameter.setArtifactName(attribute.getValue()));
        Optional.ofNullable(element.getAttribute(SUBMISSION_ATTRIBUTE_CLASSNAME)).ifPresent(attribute -> parameter.setClassName(attribute.getValue()));
        model.setSubmissionParameters(parameter);
    }));
}
Also used : SparkSubmissionParameter(com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter) Arrays(java.util.Arrays) ExecutionException(com.intellij.execution.ExecutionException) Collection(java.util.Collection) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) SparkSubmissionParameter(com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter) Executor(com.intellij.execution.Executor) InvalidDataException(com.intellij.openapi.util.InvalidDataException) Collectors(java.util.stream.Collectors) com.intellij.execution.configurations(com.intellij.execution.configurations) ArrayList(java.util.ArrayList) Pair(com.microsoft.azuretools.utils.Pair) Nullable(org.jetbrains.annotations.Nullable) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) SparkSubmissionContentPanel(com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel) Project(com.intellij.openapi.project.Project) Optional(java.util.Optional) SparkSubmitModel(com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel) Module(com.intellij.openapi.module.Module) WriteExternalException(com.intellij.openapi.util.WriteExternalException) SparkBatchJobSubmissionState(com.microsoft.azure.hdinsight.spark.run.SparkBatchJobSubmissionState) NotNull(org.jetbrains.annotations.NotNull) Element(org.jdom.Element) SettingsEditor(com.intellij.openapi.options.SettingsEditor) SparkSubmitModel(com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel) ArrayList(java.util.ArrayList)

Example 3 with SparkSubmitModel

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

the class RemoteDebugRunConfiguration method writeExternal.

@Override
public void writeExternal(Element rootElement) throws WriteExternalException {
    super.writeExternal(rootElement);
    SparkSubmitModel model = getSubmitModel();
    SparkSubmissionParameter submissionParameter = model.getSubmissionParameter();
    // The element to save editor's setting
    Element remoteDebugSettingsElement = new Element(SUBMISSION_CONTENT_NAME);
    remoteDebugSettingsElement.setAttribute(SUBMISSION_ATTRIBUTE_CLUSTER_NAME, submissionParameter.getClusterName());
    remoteDebugSettingsElement.setAttribute(SUBMISSION_ATTRIBUTE_IS_LOCAL_ARTIFACT, Boolean.toString(model.isLocalArtifact()));
    remoteDebugSettingsElement.setAttribute(SUBMISSION_ATTRIBUTE_ARTIFACT_NAME, submissionParameter.getArtifactName());
    remoteDebugSettingsElement.setAttribute(SUBMISSION_ATTRIBUTE_CLASSNAME, submissionParameter.getMainClassName());
    rootElement.addContent(remoteDebugSettingsElement);
}
Also used : SparkSubmissionParameter(com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter) SparkSubmitModel(com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel) Element(org.jdom.Element)

Aggregations

SparkSubmitModel (com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel)3 SparkSubmissionParameter (com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter)2 Element (org.jdom.Element)2 ExecutionException (com.intellij.execution.ExecutionException)1 Executor (com.intellij.execution.Executor)1 com.intellij.execution.configurations (com.intellij.execution.configurations)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 Module (com.intellij.openapi.module.Module)1 SettingsEditor (com.intellij.openapi.options.SettingsEditor)1 Project (com.intellij.openapi.project.Project)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 WriteExternalException (com.intellij.openapi.util.WriteExternalException)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 SparkBatchJobSubmissionState (com.microsoft.azure.hdinsight.spark.run.SparkBatchJobSubmissionState)1 SparkSubmissionContentPanel (com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel)1 Pair (com.microsoft.azuretools.utils.Pair)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Optional (java.util.Optional)1