Repository: incubator-livy Updated Branches: refs/heads/master c8cfe2994 -> e2d2189f4
[LIVY-479] Enable livy.rsc.launcher.address configuration ## What changes were proposed in this pull request? In current code we are setting livy.rsc.launcher.address to RPC server and ignoring whatever is specified in configs. However in some scenarios there is a need for the user to be able to explicitly configure it. For example, the IP address for an active Livy server might change over the time, so rather than using the fixed IP address, we need to specify this setting to a more generic host name. For this reason, we want to enable the capability of user side configurations. Jira: https://issues.apache.org/jira/browse/LIVY-479 ## How was this patch tested? Manual tests by changing "livy.rsc.launcher.address" and verified the setting took effect Author: Tao Li <ta...@microsoft.com> Closes #101 from taoliseki/LIVY-479. Project: http://git-wip-us.apache.org/repos/asf/incubator-livy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-livy/commit/e2d2189f Tree: http://git-wip-us.apache.org/repos/asf/incubator-livy/tree/e2d2189f Diff: http://git-wip-us.apache.org/repos/asf/incubator-livy/diff/e2d2189f Branch: refs/heads/master Commit: e2d2189f4fb000e0113befa03db16916f94e03bb Parents: c8cfe29 Author: Tao Li <ta...@microsoft.com> Authored: Wed Dec 19 14:17:51 2018 -0800 Committer: Marcelo Vanzin <van...@cloudera.com> Committed: Wed Dec 19 14:17:51 2018 -0800 ---------------------------------------------------------------------- rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/e2d2189f/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java ---------------------------------------------------------------------- diff --git a/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java b/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java index c7c5bc4..5a819d5 100644 --- a/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java +++ b/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java @@ -97,7 +97,13 @@ class ContextLauncher { String replMode = conf.get("repl"); boolean repl = replMode != null && replMode.equals("true"); - conf.set(LAUNCHER_ADDRESS, factory.getServer().getAddress()); + // In some scenarios the user may need to configure this endpoint setting explicitly. + String address = conf.get(LAUNCHER_ADDRESS); + // If not specified, use the RPC server address; otherwise use the specified address. + if (address == null || address.trim().isEmpty()) { + address = factory.getServer().getAddress(); + } + conf.set(LAUNCHER_ADDRESS, address); conf.set(LAUNCHER_PORT, factory.getServer().getPort()); conf.set(CLIENT_ID, clientId); conf.set(CLIENT_SECRET, secret);