From f0009247d4babda75f15687ac2c754049cda342b Mon Sep 17 00:00:00 2001 From: Kostas Kougios Date: Sun, 14 Jan 2024 17:52:30 +0000 Subject: [PATCH] - --- example-spark/etc/logback.xml | 19 +++++++++++++++++++ example-spark/project.scala | 6 ++++++ example-spark/spark-notebook.sc | 5 +++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 example-spark/etc/logback.xml diff --git a/example-spark/etc/logback.xml b/example-spark/etc/logback.xml new file mode 100644 index 00000000..f037a072 --- /dev/null +++ b/example-spark/etc/logback.xml @@ -0,0 +1,19 @@ + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + diff --git a/example-spark/project.scala b/example-spark/project.scala index b37b5a0e..f921305a 100644 --- a/example-spark/project.scala +++ b/example-spark/project.scala @@ -4,9 +4,15 @@ // these java params are needed for spark to work with jdk 21 //> using javaOpt --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/sun.util.calendar=ALL-UNNAMED --add-opens java.base/sun.security.action=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED +// configure logback +//> using javaOpt -Dlogback.configurationFile=file:etc/logback.xml + +// terminal21 dependencies //> using dep io.github.kostaskougios::terminal21-ui-std:0.11 //> using dep io.github.kostaskougios::terminal21-spark:0.11 //> using dep io.github.kostaskougios::terminal21-nivo:0.11 //> using dep io.github.kostaskougios::terminal21-mathjax:0.11 +//> using dep ch.qos.logback:logback-classic:1.4.14 + //> using file model diff --git a/example-spark/spark-notebook.sc b/example-spark/spark-notebook.sc index f97b3bbe..c0cce5e2 100755 --- a/example-spark/spark-notebook.sc +++ b/example-spark/spark-notebook.sc @@ -8,7 +8,8 @@ * on each restart of the script. We can force re-evaluation by clicking the "Recalculate" buttons in the UI. */ -import org.apache.spark.sql.{Dataset, SparkSession} +// We need these imports +import org.apache.spark.sql.* import org.terminal21.client.components.* import org.terminal21.client.components.chakra.* import org.terminal21.client.components.nivo.* @@ -20,7 +21,7 @@ import scala.util.Random import SparkNotebook.* import org.terminal21.client.components.mathjax.{MathJax, MathJaxLib} -SparkSessions.newTerminal21WithSparkSession(SparkSessions.newSparkSession(), "spark-notebook", "Spark Notebook", NivoLib, MathJaxLib): (spark, session) => +SparkSessions.newTerminal21WithSparkSession(SparkSessions.newSparkSession(/* configure your spark session here */), "spark-notebook", "Spark Notebook", NivoLib, MathJaxLib): (spark, session) => given ConnectedSession = session given SparkSession = spark import scala3encoders.given