org.apache.spark.scheduler.SparkListener Java Examples
The following examples show how to use
org.apache.spark.scheduler.SparkListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Spark3Shims.java From zeppelin with Apache License 2.0 | 5 votes |
public void setupSparkListener(final String master, final String sparkWebUrl, final InterpreterContext context) { SparkContext sc = SparkContext.getOrCreate(); sc.addSparkListener(new SparkListener() { @Override public void onJobStart(SparkListenerJobStart jobStart) { if (sc.getConf().getBoolean("spark.ui.enabled", true) && !Boolean.parseBoolean(properties.getProperty("zeppelin.spark.ui.hidden", "false"))) { buildSparkJobUrl(master, sparkWebUrl, jobStart.jobId(), jobStart.properties(), context); } } }); }
Example #2
Source File: Spark2Shims.java From zeppelin with Apache License 2.0 | 5 votes |
public void setupSparkListener(final String master, final String sparkWebUrl, final InterpreterContext context) { SparkContext sc = SparkContext.getOrCreate(); sc.addSparkListener(new SparkListener() { @Override public void onJobStart(SparkListenerJobStart jobStart) { if (sc.getConf().getBoolean("spark.ui.enabled", true) && !Boolean.parseBoolean(properties.getProperty("zeppelin.spark.ui.hidden", "false"))) { buildSparkJobUrl(master, sparkWebUrl, jobStart.jobId(), jobStart.properties(), context); } } }); }
Example #3
Source File: SparkListenerServiceImpl.java From beakerx with Apache License 2.0 | 4 votes |
@Override public void configure(SparkSessionBuilder sparkSessionBuilder, SparkUIApi sparkUI) { SparkContext sc = sparkSessionBuilder.getOrCreate().sparkContext(); sc.addSparkListener(new SparkListener() { @Override public void onJobStart(SparkListenerJobStart jobStart) { super.onJobStart(jobStart); } @Override public void onJobEnd(SparkListenerJobEnd jobEnd) { super.onJobEnd(jobEnd); } @Override public void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted) { super.onStageSubmitted(stageSubmitted); sparkUI.startStage(stageSubmitted.stageInfo().stageId(), stageSubmitted.stageInfo().numTasks()); } @Override public void onStageCompleted(SparkListenerStageCompleted stageCompleted) { super.onStageCompleted(stageCompleted); sparkUI.endStage(stageCompleted.stageInfo().stageId()); } @Override public void onTaskStart(SparkListenerTaskStart taskStart) { super.onTaskStart(taskStart); sparkUI.taskStart(taskStart.stageId(), taskStart.taskInfo().taskId()); } @Override public void onTaskEnd(SparkListenerTaskEnd taskEnd) { super.onTaskEnd(taskEnd); String reason = taskEnd.reason().toString(); if (reason.equals("Success")) { sparkUI.taskEnd(taskEnd.stageId(), taskEnd.taskInfo().taskId()); } else if (reason.contains("stage cancelled")) { sparkUI.taskCancelled(taskEnd.stageId(), taskEnd.taskInfo().taskId()); } } }); }