Description
We allow developers to customize their JAVA_HOME setting for both the container and AM. This change was made in SAMZA-308. Recently, we began noticing that if task.java.home is not set, JAVA_HOME is set to an empty string when run-container.sh/run-am.sh are executed (both in ProcessJob and YarnJob). This holds true even if JAVA_HOME has been exported (and is not empty) in the environment from which the container/am is being started.
This is problematic in the case of YARN, for example, where the NM will automatically forward its JAVA_HOME setting to containers if JAVA_HOME is not set. When Samza sets JAVA_HOME to empty, YARN's NM will no longer forward the JAVA_HOME value.
I believe that we need to fix both ShellCommandBuilder and YarnJob to only set JAVA_HOME if task.java.home/yarn.am.java.home are not None.