Skip to content

Commit

Permalink
#7326: send sparkAppId
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslawmalekcodete committed May 23, 2018
1 parent 6c17bde commit 7c4bd57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public interface SparkManager {

SparkSession.Builder getBuilder();

String getSparkAppId();

interface SparkManagerFactory {
SparkManager create(SparkSession.Builder sparkSessionBuilder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.spark.scheduler.SparkListenerStageSubmitted;
import org.apache.spark.scheduler.SparkListenerTaskEnd;
import org.apache.spark.scheduler.SparkListenerTaskStart;
import org.apache.spark.sql.RuntimeConfig;
import org.apache.spark.sql.SparkSession;
import scala.Tuple2;
import scala.collection.Iterator;
Expand Down Expand Up @@ -76,6 +77,12 @@ public SparkSession getOrCreate() {
return sparkSessionBuilder.getOrCreate();
}

@Override
public String getSparkAppId() {
RuntimeConfig conf = getOrCreate().conf();
return conf.getAll().get("spark.app.id").get();
}

@Override
public SparkContext sparkContext() {
return getOrCreate().sparkContext();
Expand Down Expand Up @@ -191,7 +198,7 @@ private static boolean isLocalSpark(SparkConf sparkConf) {
}


public static class SparkManagerFactoryImpl implements SparkManagerFactory{
public static class SparkManagerFactoryImpl implements SparkManagerFactory {

@Override
public SparkManager create(SparkSession.Builder sparkSessionBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import com.twosigma.beakerx.kernel.KernelManager;
import com.twosigma.beakerx.message.Message;
import org.apache.spark.sql.SparkSession;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -132,10 +130,10 @@ private void sendError(Message parentMessage, KernelFunctionality kernel, String
seo.error(message);
}


public void applicationStart() {
sparkUI.clearView();
statusPanel = createStatusPanel();
sparkUI.sendUpdate("sparkAppId", sparkManager.getSparkAppId());
}

public void applicationEnd() {
Expand Down

0 comments on commit 7c4bd57

Please sign in to comment.