You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by hs...@apache.org on 2015/10/10 05:31:54 UTC

incubator-twill git commit: Remove the if-check in the YarnTwillPreparer class for log level when setting env key.

Repository: incubator-twill
Updated Branches:
  refs/heads/master e95c6a495 -> f6d2b6c42


Remove the if-check in the YarnTwillPreparer class for log level when setting env key.

Add precondition check in the setLogLevel method to prevent setting null early.

This closes #67

Signed-off-by: hsaputra <hs...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-twill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-twill/commit/f6d2b6c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-twill/tree/f6d2b6c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-twill/diff/f6d2b6c4

Branch: refs/heads/master
Commit: f6d2b6c427bd7ccec3951cfdeeb2b0e2db12e6da
Parents: e95c6a4
Author: hsaputra <hs...@apache.org>
Authored: Fri Oct 9 13:23:28 2015 -0700
Committer: hsaputra <hs...@apache.org>
Committed: Fri Oct 9 20:31:30 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/twill/yarn/YarnTwillPreparer.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/f6d2b6c4/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillPreparer.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillPreparer.java b/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillPreparer.java
index 6da2f8b..d4edfeb 100644
--- a/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillPreparer.java
+++ b/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillPreparer.java
@@ -300,6 +300,7 @@ final class YarnTwillPreparer implements TwillPreparer {
 
   @Override
   public TwillPreparer setLogLevel(LogEntry.Level logLevel) {
+    Preconditions.checkNotNull(logLevel);
     this.logLevel = logLevel;
     return this;
   }
@@ -350,10 +351,8 @@ final class YarnTwillPreparer implements TwillPreparer {
             .put(EnvKeys.TWILL_APP_NAME, twillSpec.getName())
             .put(EnvKeys.YARN_RM_SCHEDULER_ADDRESS, yarnConfig.get(YarnConfiguration.RM_SCHEDULER_ADDRESS));
 
-          if (logLevel != null) {
-            LOG.debug("Log level is set to {} for the Twill application.", logLevel);
-            builder.put(EnvKeys.TWILL_APP_LOG_LEVEL, logLevel.toString());
-          }
+          LOG.debug("Log level is set to {} for the Twill application.", logLevel);
+          builder.put(EnvKeys.TWILL_APP_LOG_LEVEL, logLevel.toString());
 
           int memory = Resources.computeMaxHeapSize(appMasterInfo.getMemoryMB(),
                                                     Constants.APP_MASTER_RESERVED_MEMORY_MB, Constants.HEAP_MIN_RATIO);