Re: Reading configuration file in Spark Scala throws error

2019-08-04 Thread Mich Talebzadeh
OK it turned up pretty simple once I established where to read the conf file in yarn mode and get the values for different keys val dbHost = conf.getString("dbHost") val dbPort = conf.getString("dbPort") val dbConnection = conf.getString("dbConnection") val namespace =

Re: Reading configuration file in Spark Scala throws error

2019-08-04 Thread Mich Talebzadeh
Many thanks Chris. In my Spark streaming I would like to use the config file to read the parameters in. Taking your example, I have val globalConfig = ConfigFactory.load() val conf = globalConfig.getConfig(sparkAppName) // extract out top level key from top level namespace

Re: Reading configuration file in Spark Scala throws error

2019-08-03 Thread Chris Teoh
This seems to work- val printEntry = new java.util.function.Consumer[java.util.Map.Entry[String,com.typesafe.config.ConfigValue]] { override def accept(a: java.util.Map.Entry[String,com.typesafe.config.ConfigValue]): Unit = { println(a.getKey) } }

Reading configuration file in Spark Scala throws error

2019-08-03 Thread Mich Talebzadeh
Hi, I have a config file application.conf that I am trying to read. The skeleton code is as follows: ``` import com.typesafe.config.ConfigFactory import scala.collection.JavaConverters def main(args: Array[String]): Unit = { val globalConfig = ConfigFactory.load() // pass in filename