Search in sources :

Example 11 with IClusterDetail

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

the class SparkSubmitModel method deployArtifactObservable.

public Single<IClusterDetail> deployArtifactObservable(Artifact artifact, IClusterDetail clusterDetail) {
    return Single.create(em -> {
        IClusterDetail selectedClusterDetail = getClusterConfiguration(clusterDetail, true);
        if (selectedClusterDetail == null) {
            String errorMessage = "Selected Cluster can not found. Please login in first in HDInsight Explorer and try submit job again";
            HDInsightUtil.showErrorMessageOnSubmissionMessageWindow(project, errorMessage);
            em.onError(new HDIException(errorMessage));
            return;
        }
        try {
            uploadFileToCluster(selectedClusterDetail, artifact.getName());
            em.onSuccess(selectedClusterDetail);
        } catch (Exception exception) {
            showFailedSubmitErrorMessage(exception);
            em.onError(exception);
        }
    });
}
Also used : HDIException(com.microsoft.azure.hdinsight.sdk.common.HDIException) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) URISyntaxException(java.net.URISyntaxException) AuthenticationException(com.microsoft.azure.hdinsight.sdk.common.AuthenticationException) HDIException(com.microsoft.azure.hdinsight.sdk.common.HDIException) IOException(java.io.IOException)

Example 12 with IClusterDetail

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

the class SparkSubmissionContentPanel method initializeModel.

private void initializeModel() {
    clustersListComboBox.getButton().setEnabled(false);
    DefaultLoader.getIdeHelper().executeOnPooledThread(() -> {
        Project project = submitModel.getProject();
        HDInsightUtil.showInfoOnSubmissionMessageWindow(submitModel.getProject(), "List spark clusters ...", true);
        List<IClusterDetail> cachedClusters = ClusterManagerEx.getInstance().getClusterDetailsWithoutAsync(true, submitModel.getProject());
        if (!ClusterManagerEx.getInstance().isSelectedSubscriptionExist()) {
            HDInsightUtil.showWarningMessageOnSubmissionMessageWindow(project, "No selected subscription(s), Please go to HDInsight Explorer to sign in....");
        }
        if (ClusterManagerEx.getInstance().isListClusterSuccess()) {
            HDInsightUtil.showInfoOnSubmissionMessageWindow(project, "List spark clusters successfully");
        } else {
            HDInsightUtil.showErrorMessageOnSubmissionMessageWindow(project, "Error : Failed to list spark clusters.");
        }
        if (ClusterManagerEx.getInstance().isLIstAdditionalClusterSuccess()) {
            HDInsightUtil.showInfoOnSubmissionMessageWindow(project, "List additional spark clusters successfully");
        } else {
            HDInsightUtil.showErrorMessageOnSubmissionMessageWindow(project, "Error: Failed to list additional cluster");
        }
        submitModel.setClusterComboBoxModel(cachedClusters);
        clustersListComboBox.getComboBox().setModel(submitModel.getClusterComboBoxModel());
        clustersListComboBox.getButton().setEnabled(true);
    });
    selectedArtifactComboBox.setModel(submitModel.getArtifactComboBoxModel());
    jobConfigurationTable.setModel(submitModel.getTableModel());
}
Also used : Project(com.intellij.openapi.project.Project) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail)

Example 13 with IClusterDetail

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

the class HDInsightHelperImpl method openJobViewEditor.

public void openJobViewEditor(Object projectObject, String uuid) {
    IClusterDetail clusterDetail = JobViewManager.getCluster(uuid);
    Project project = (Project) projectObject;
    VirtualFile openedFile = getOpenedItem(project);
    if (openedFile == null || isNeedReopen(openedFile, clusterDetail)) {
        openItem(project, clusterDetail, uuid, openedFile);
    } else {
        openItem(project, openedFile, null);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) Project(com.intellij.openapi.project.Project) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail)

Example 14 with IClusterDetail

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

the class HDInsightHelperImpl method openJobViewEditor.

public void openJobViewEditor(Object projectObject, String uuid) {
    try {
        loadHDInsightPlugin();
    } catch (BundleException bundleException) {
        Activator.getDefault().log("Error loading plugin " + HDINSIHGT_BUNDLE_ID, bundleException);
    }
    IClusterDetail clusterDetail = JobViewManager.getCluster(uuid);
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azure.hdinsight.jobview");
    try {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IEditorPart newEditor = page.openEditor(new JobViewInput(clusterDetail, uuid), editorDescriptor.getId());
    } catch (PartInitException e2) {
        Activator.getDefault().log("Error opening " + clusterDetail.getName(), e2);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) BundleException(org.osgi.framework.BundleException) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) JobViewInput(com.microsoft.azuretools.azureexplorer.editors.JobViewInput)

Aggregations

IClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail)14 IOException (java.io.IOException)4 URISyntaxException (java.net.URISyntaxException)4 ExecutionException (com.intellij.execution.ExecutionException)2 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)2 Project (com.intellij.openapi.project.Project)2 JSchException (com.jcraft.jsch.JSchException)2 ArrayList (java.util.ArrayList)2 CompositeException (rx.exceptions.CompositeException)2 GenericDebuggerRunner (com.intellij.debugger.impl.GenericDebuggerRunner)1 GenericDebuggerRunnerSettings (com.intellij.debugger.impl.GenericDebuggerRunnerSettings)1 Executor (com.intellij.execution.Executor)1 ConfigurationInfoProvider (com.intellij.execution.configurations.ConfigurationInfoProvider)1 RunProfile (com.intellij.execution.configurations.RunProfile)1 RunProfileState (com.intellij.execution.configurations.RunProfileState)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 HDInsightUtil (com.microsoft.azure.hdinsight.common.HDInsightUtil)1