aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciano Resende <lresende@apache.org>2017-01-14 10:34:29 -0800
committerLuciano Resende <lresende@apache.org>2017-01-14 10:39:09 -0800
commit4a0c01b124c3fa9495c5eb2d71af4c3f2e2ffe6e (patch)
treed566ebb5c5115beaaa90c56b74c65566a2d5190d
parent0493bbe9479b5acb9f93bc76f743e87749be9b3e (diff)
downloadtoree-gateway-4a0c01b124c3fa9495c5eb2d71af4c3f2e2ffe6e.tar.gz
toree-gateway-4a0c01b124c3fa9495c5eb2d71af4c3f2e2ffe6e.tar.bz2
toree-gateway-4a0c01b124c3fa9495c5eb2d71af4c3f2e2ffe6e.zip
Enable logging
-rw-r--r--src/main/scala/com/ibm/ToreeClient.scala21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/scala/com/ibm/ToreeClient.scala b/src/main/scala/com/ibm/ToreeClient.scala
index 4da2ca5..c9dedcf 100644
--- a/src/main/scala/com/ibm/ToreeClient.scala
+++ b/src/main/scala/com/ibm/ToreeClient.scala
@@ -13,6 +13,8 @@ import py4j.GatewayServer
import scala.concurrent.{Await, Promise}
import scala.concurrent.duration.Duration
+import org.slf4j.LoggerFactory
+
class ToreeGateway(client: SparkKernelClient) {
// Define our callback
def printResult(result: ExecuteResult) = {
@@ -31,6 +33,7 @@ class ToreeGateway(client: SparkKernelClient) {
object ToreeClient extends App {
+ final val log = LoggerFactory.getLogger(this.getClass.getName.stripSuffix("$"))
def getConfigurationFilePath: String = {
var filePath = "/opt/toree_proxy/conf/profile.json"
@@ -46,8 +49,19 @@ object ToreeClient extends App {
filePath
}
+ log.info("Application Initialized from " + new java.io.File(".").getCanonicalPath)
+ log.info("With the following parameters:" )
+ if (args.length == 0 ) {
+ log.info(">>> NONE" )
+ } else {
+ for (arg <- args) {
+ log.info(">>> Arg :" + arg )
+ }
+ }
+
// Parse our configuration and create a client connecting to our kernel
val configFileContent = scala.io.Source.fromFile(getConfigurationFilePath).mkString
+ log.info(">>> Configuration in use " + configFileContent)
val config: Config = ConfigFactory.parseString(configFileContent)
val client = (new ClientBootstrap(config)
@@ -55,13 +69,6 @@ object ToreeClient extends App {
with StandardHandlerInitialization).createClient()
val toreeGateway = new ToreeGateway(client)
- /*
- val code: String =
- """
- |sc.parallelize(List(1,2,3,4,5)).reduce((a, b) => a + b)
- """.stripMargin
- print(toreeGateway.eval(args(0)))
- */
val gatewayServer: GatewayServer = new GatewayServer(toreeGateway)
gatewayServer.start()