You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Chang Liu <fl...@gmail.com> on 2018/07/31 11:59:18 UTC

Pass JVM option (-Dconfig.file) per job in standalone mode?

Dear all,

I would like to know is there a way to pass JVM options (for example, -Dconfig.file=application.conf) for each submitted flink job? I am using the Config library from lightbend.

./bin/flink run examples/Example.jar -Dconfig.file=/path/application.conf

Best regards/祝好,

Chang Liu 刘畅



Re: Pass JVM option (-Dconfig.file) per job in standalone mode?

Posted by Chang Liu <fl...@gmail.com>.
Hi Dominik,

Thanks for your reply. I thought so as well. But I am having some problems with passing program args.

Currently, i have the following:

object Configs {

  lazy val CONFIG: Config = ConfigFactory.load()

  lazy val config1: String = CONFIG.getString("key1")
  lazy val config2: String = CONFIG.getString("key2")
  lazy val config3: String = CONFIG.getString("key3")
  ...


}

If I pass the application.conf as program args, it will be like this:


object Configs {

  def setup(file: String): Unit = CONFIG = ConfigFactory.parseFile(new File(file))

  var CONFIG: Config = _

  lazy val config1: String = CONFIG.getString("key1")
  lazy val config2: String = CONFIG.getString("key2")
  lazy val config3: String = CONFIG.getString("key3")
  ...


}


This Scala code is not looking good I think. 
The CONFG is var instead of val
I have to call setup every time
I have some other object or vals which initialised depending on the parameters. If the parameters are passed in as program args instead of from JVM option, these object vals cannot be initialised properly.


And ideas about it?  Many Thanks :)


Best regards/祝好,

Chang Liu 刘畅


> On 31 Jul 2018, at 14:15, Dominik Wosiński <wo...@gmail.com> wrote:
> 
> Hey, 
> I don't think that it's possible per job. You can pass only program arguments but not JVM options. 
> 
> Regards,
> Dominik.
> 
> 2018-07-31 13:59 GMT+02:00 Chang Liu <fluency.03@gmail.com <ma...@gmail.com>>:
> Dear all,
> 
> I would like to know is there a way to pass JVM options (for example, -Dconfig.file=application.conf) for each submitted flink job? I am using the Config library from lightbend.
> 
> ./bin/flink run examples/Example.jar -Dconfig.file=/path/application.conf
> 
> Best regards/祝好,
> 
> Chang Liu 刘畅
> 
> 
>