You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/03/22 16:20:41 UTC
[jira] [Commented] (TOREE-380) Interpreters should be allowed to
send results other than text/plain.
[ https://issues.apache.org/jira/browse/TOREE-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15936608#comment-15936608 ]
ASF GitHub Bot commented on TOREE-380:
--------------------------------------
Github user kevin-bates commented on a diff in the pull request:
https://github.com/apache/incubator-toree/pull/104#discussion_r107460553
--- Diff: scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala ---
@@ -18,37 +18,45 @@
package org.apache.toree.kernel.interpreter.scala
import java.io.ByteArrayOutputStream
-import java.net.{URL, URLClassLoader}
-import java.nio.charset.Charset
import java.util.concurrent.ExecutionException
import com.typesafe.config.{Config, ConfigFactory}
import org.apache.spark.SparkContext
-import org.apache.spark.sql.SparkSession
import org.apache.spark.repl.Main
+import org.apache.spark.sql.SparkSession
import org.apache.toree.interpreter._
-import org.apache.toree.kernel.api.{KernelLike, KernelOptions}
+import org.apache.toree.kernel.api.KernelLike
import org.apache.toree.utils.{MultiOutputStream, TaskManager}
import org.slf4j.LoggerFactory
import org.apache.toree.kernel.BuildInfo
import scala.annotation.tailrec
+import scala.collection.mutable
import scala.concurrent.{Await, Future}
import scala.language.reflectiveCalls
import scala.tools.nsc.Settings
import scala.tools.nsc.interpreter.{IR, OutputStream}
import scala.tools.nsc.util.ClassPath
-import scala.util.{Try => UtilTry}
+
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.MagicOutput
+import vegas.DSL.ExtendedUnitSpecBuilder
+import vegas.render.StaticHTMLRenderer
+
class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends Interpreter with ScalaInterpreterSpecific {
+ import ScalaInterpreter._
+
+ private var kernel: KernelLike = _
+
protected val logger = LoggerFactory.getLogger(this.getClass.getName)
protected val _thisClassloader = this.getClass.getClassLoader
protected val lastResultOut = new ByteArrayOutputStream()
- protected val multiOutputStream = MultiOutputStream(List(Console.out, lastResultOut))
+ protected val multiOutputStream = lastResultOut
--- End diff --
At a minimum, this needs to remain a MultiOutputStream (of one item) else it will produce a compilation error in [here](https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala#L41). Removal of Console.out is further discussed in #116.
> Interpreters should be allowed to send results other than text/plain.
> ---------------------------------------------------------------------
>
> Key: TOREE-380
> URL: https://issues.apache.org/jira/browse/TOREE-380
> Project: TOREE
> Issue Type: Improvement
> Reporter: Ryan Blue
>
> Jupyter allows kernels to send results using different content types, but this isn't allowed by Toree for its interpreters. This prevents custom display logic. The basic problem is that {{ExecuteOutput}} is a {{String}} and not a {{Map[String, String]}} like {{CellMagicOutput}}.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)