Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7535 yet further spark UI polish #7565

Merged
merged 6 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions js/notebook/src/SparkUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,23 @@ export class SparkUIView extends widgets.VBoxView {
}

private setupTooltips(): void {
this.el.querySelector('.bx-spark-connect').setAttribute('title', "Start a session with a cluster (or a local instance)");
this.el.querySelector('.bx-spark-profile select').setAttribute('title', "Set all properties from a named profile");
this.el.querySelector('.bx-spark-executor-cores input').setAttribute('title', "The number of cores to use on each executor");
this.el.querySelector('.bx-spark-executor-memory input').setAttribute('title', "Amount of memory to use per executor process, in MiB unless otherwise specified. (e.g. 2g, 8g).");
const startButton = this.el.querySelector('.bx-spark-connect');
const profileSelect = this.el.querySelector('.bx-spark-profile select');
const executorCoresInput = this.el.querySelector('.bx-spark-executor-cores input');
const executorMemmoryInput = this.el.querySelector('.bx-spark-executor-memory input');

if (startButton) {
startButton.setAttribute('title', "Start a session with a cluster (or a local instance)");
}
if (profileSelect) {
profileSelect.setAttribute('title', "Set all properties from a named profile");
}
if (executorCoresInput) {
executorCoresInput.setAttribute('title', "The number of cores to use on each executor");
}
if (executorMemmoryInput) {
executorMemmoryInput.setAttribute('title', "Amount of memory to use per executor process, in MiB unless otherwise specified. (e.g. 2g, 8g).");
}
}

private handleFormState() {
Expand Down Expand Up @@ -246,6 +259,12 @@ export class SparkUIView extends widgets.VBoxView {
this.connectionLabelDead = this.sparkStats.node.querySelector('.dead');

this.connectionStatusElement.insertAdjacentElement('afterend', this.sparkStats.node);

this.updateSparkStatsStyles();
}

private updateSparkStatsStyles(): void {
this.sparkStats.node.style.marginRight = `${290 - (this.sparkStats.node.offsetWidth + this.connectionStatusElement.offsetWidth)}px`;
}

private connectToApi() {
Expand Down
6 changes: 5 additions & 1 deletion js/notebook/src/shared/style/spark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
}

.bx-status-panel {
padding: 2px 0;
.bx-button {
margin-left: 20px;
height: 24px;
padding: 0 6px;
}
Expand Down Expand Up @@ -198,6 +198,10 @@
text-align: right;
}

.bx-spark-connect {
margin-left: 306px;
}

.bx-spark-connect-error {
margin-left: 20px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,20 @@ private void initSparkContext(Message parentMessage) {

private void configureSparkContext(Message parentMessage, KernelFunctionality kernel) {
try {
this.sparkUIForm.setAllToDisabled();
TryResult configure = sparkEngine.configure(kernel, this, parentMessage);
if (configure.isError()) {
this.sparkUIForm.sendError(StacktraceHtmlPrinter.printRedBold(ERROR_CREATING_SPARK_SESSION));
this.sparkUIForm.setAllToEnabled();
} else {
singleSparkSession.active();
sparkUIForm.saveDefaults();
sparkUIForm.getConnectButton().setDomClasses(asList("hidden"));
sparkUiDefaults.saveProfileName(sparkUIForm.getProfileName());
applicationStart();
}
} catch (Exception e) {
this.sparkUIForm.setAllToEnabled();
this.sparkUIForm.sendError(StacktraceHtmlPrinter.printRedBold(e.getMessage()));
}
}
Expand All @@ -132,7 +136,6 @@ private SparkSession getSparkSession() {
private void applicationStart() {
this.statusPanel = new SparkUIStatus(message -> getSparkSession().sparkContext().stop());
this.sparkUIForm.setDomClasses(new ArrayList<>(asList("bx-disabled")));
this.sparkUIForm.setAllToDisabled();
add(0, this.statusPanel);
sendUpdate(SPARK_APP_ID, sparkEngine.getSparkAppId());
sendUpdate("sparkUiWebUrl", sparkEngine.getSparkUiWebUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,20 @@ public String getProfileName() {
public void setAllToDisabled() {
this.profileManagement.getChildren().stream().map(x -> (ValueWidget) x).forEach(x -> x.setDisabled(true));
this.advancedOption.setDisabledToAll();
this.connectButton.setDisabled(true);
this.masterURL.setDisabled(true);
this.executorMemory.setDisabled(true);
this.executorCores.setDisabled(true);
}

public void setAllToEnabled() {
this.profileManagement.getChildren().stream().map(x -> (ValueWidget) x).forEach(x -> x.setDisabled(false));
this.advancedOption.setEnabledToAll();
this.connectButton.setDisabled(false);
this.connectButton.setDomClasses(new ArrayList<>(asList("bx-spark-connect")));
this.masterURL.setDisabled(false);
this.executorMemory.setDisabled(false);
this.executorCores.setDisabled(false);
refreshElementsAvailability();
}

Expand Down