use of com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter in project azure-tools-for-java by Microsoft.
the class SparkSubmissionExDialog method constructSubmissionParameter.
private SparkSubmissionParameter constructSubmissionParameter() {
IClusterDetail selectedClusterDetail = getSelectedCluster(clustersListComboBox.getText());
String selectedArtifactName = projectArtifactSelectComboBox.getText();
String className = mainClassCombo.getText().trim();
String commandLine = commandLineTextField.getText().trim();
String localArtifactPath = localArtifactInput.getText();
String selectedClusterName = selectedClusterDetail.getName();
List<String> referencedFileList = new ArrayList<>();
for (String singleReferencedFile : referencedFilesTextField.getText().split(";")) {
singleReferencedFile = singleReferencedFile.trim();
if (!StringHelper.isNullOrWhiteSpace(singleReferencedFile)) {
referencedFileList.add(singleReferencedFile);
}
}
List<String> uploadedFilePathList = new ArrayList<>();
for (String singleReferencedJars : referencedJarsTextField.getText().split(";")) {
singleReferencedJars = singleReferencedJars.trim();
if (!StringHelper.isNullOrWhiteSpace(singleReferencedJars)) {
uploadedFilePathList.add(singleReferencedJars);
}
}
List<String> argsList = new ArrayList<>();
for (String singleArs : commandLine.split(" ")) {
if (!StringHelper.isNullOrWhiteSpace(singleArs)) {
argsList.add(singleArs.trim());
}
}
// FIXME: need a duplicated keys check when creating a new row is allowed
final Map<String, Object> jobConfigMap = jobConfigs.stream().collect(Collectors.toMap(Pair::first, Pair::second));
return new SparkSubmissionParameter(selectedClusterName, localArtifactRadioButton.getSelection(), selectedArtifactName, localArtifactPath, null, className, referencedFileList, uploadedFilePathList, argsList, jobConfigMap);
}
use of com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter 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);
}));
}
use of com.microsoft.azure.hdinsight.spark.common.SparkSubmissionParameter 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);
}
Aggregations