Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaskougios committed Jan 14, 2024
1 parent 8998617 commit f000924
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
19 changes: 19 additions & 0 deletions example-spark/etc/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<configuration>

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>

<logger name="org.apache.spark" level="ERROR" />

<root level="ERROR">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
6 changes: 6 additions & 0 deletions example-spark/project.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions example-spark/spark-notebook.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -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
Expand Down

0 comments on commit f000924

Please sign in to comment.