cameronlee314 commented on a change in pull request #1266: SAMZA-2452 : Adding 
internal autosizing related configs
URL: https://github.com/apache/samza/pull/1266#discussion_r375473908
 
 

 ##########
 File path: samza-core/src/test/java/org/apache/samza/config/TestJobConfig.java
 ##########
 @@ -608,4 +604,42 @@ public void testAutosizingConfig() {
     Assert.assertEquals(900, clusterManagerConfig.getContainerMemoryMb());
     Assert.assertEquals(2, clusterManagerConfig.getNumCores());
   }
+
+  @Test
+  public void testGetTaskOptsAutosizingDisabled() {
+    ShellCommandConfig shellCommandConfig =
+        new ShellCommandConfig(new 
MapConfig(ImmutableMap.of(JobConfig.JOB_AUTOSIZING_ENABLED, "false")));
+    assertEquals(Option.empty(), shellCommandConfig.getTaskOpts());
+
+    String taskOpts = "-Dproperty=value";
+    shellCommandConfig = new ShellCommandConfig(new MapConfig(
+        ImmutableMap.of(ShellCommandConfig.TASK_JVM_OPTS(), taskOpts, 
JobConfig.JOB_AUTOSIZING_ENABLED, "false")));
+    assertEquals(Option.apply(taskOpts), shellCommandConfig.getTaskOpts());
+  }
+
+  @Test
+  public void testGetTaskOptsAutosizingEnabled() {
+    // opts not set, autosizing max heap not set
+    ShellCommandConfig shellCommandConfig =
+        new ShellCommandConfig(new 
MapConfig(ImmutableMap.of(JobConfig.JOB_AUTOSIZING_ENABLED, "true")));
+    assertEquals(Option.empty(), shellCommandConfig.getTaskOpts());
+
+    // opts set, autosizing max heap not set
+    String taskOpts = "-Dproperty=value";
+    shellCommandConfig = new ShellCommandConfig(new MapConfig(
+        ImmutableMap.of(ShellCommandConfig.TASK_JVM_OPTS(), taskOpts, 
JobConfig.JOB_AUTOSIZING_ENABLED, "true")));
+    assertEquals(Option.apply(taskOpts), shellCommandConfig.getTaskOpts());
+
+    // opts not set, autosizing max heap set
+    shellCommandConfig = new ShellCommandConfig(new MapConfig(
+        ImmutableMap.of(JobConfig.JOB_AUTOSIZING_ENABLED, "true", 
JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB,
+            "1024")));
+    assertEquals(Option.apply("-Xmx1024m"), shellCommandConfig.getTaskOpts());
+
+    // opts set without -Xmx, autosizing max heap set
+    shellCommandConfig = new ShellCommandConfig(new MapConfig(
+        ImmutableMap.of(JobConfig.JOB_AUTOSIZING_ENABLED, "true", 
JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB,
+            "1024")));
+    assertEquals(Option.apply("-Xmx1024m"), shellCommandConfig.getTaskOpts());
 
 Review comment:
   1. I saw your change, but I meant to refer to the lines immediately above 
this. I think this code block needs to be changed (not removed) to have a 
non-empty opts that doesn't have an -Xmx param.
   2. I would also suggest adding a test in which opts has -Xmx but needs to be 
replaced by the autosizing config.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to