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_r374971757
##########
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:
I think this section is the same as the block above. Seems like the code
doesn't match the comment.
----------------------------------------------------------------
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