mynameborat commented on code in PR #1689:
URL: https://github.com/apache/samza/pull/1689#discussion_r1399802665
##########
samza-core/src/main/java/org/apache/samza/config/ShellCommandConfig.java:
##########
@@ -97,20 +100,16 @@ public String getCommand() {
}
public Optional<String> getTaskOpts() {
- Optional<String> jvmOpts =
Optional.ofNullable(get(ShellCommandConfig.TASK_JVM_OPTS));
- Optional<String> maxHeapMbOptional =
Optional.ofNullable(get(JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB));
- if (new JobConfig(this).getAutosizingEnabled() &&
maxHeapMbOptional.isPresent()) {
- String maxHeapMb = maxHeapMbOptional.get();
- String xmxSetting = "-Xmx" + maxHeapMb + "m";
- if (jvmOpts.isPresent() && jvmOpts.get().contains("-Xmx")) {
- jvmOpts = Optional.of(jvmOpts.get().replaceAll("-Xmx\\S+",
xmxSetting));
- } else if (jvmOpts.isPresent()) {
- jvmOpts = Optional.of(jvmOpts.get().concat(" " + xmxSetting));
- } else {
- jvmOpts = Optional.of(xmxSetting);
- }
- }
- return jvmOpts;
+ String taskOpts = get(ShellCommandConfig.TASK_JVM_OPTS);
+ String autosizingContainerMaxHeap =
get(JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB);
+
+ return Optional.ofNullable(getFinalJvmOptions(taskOpts,
autosizingContainerMaxHeap));
+ }
+
+ public Optional<String> getWorkerOpts() {
+ String autosizingWorkerHeapMb =
get(JobConfig.JOB_AUTOSIZING_WORKER_MAX_HEAP_MB);
Review Comment:
We don't know what would be the ideal default. Leaving it to the JVM to
infer this or use its own default for now.
##########
samza-core/src/main/java/org/apache/samza/config/ShellCommandConfig.java:
##########
@@ -97,20 +100,16 @@ public String getCommand() {
}
public Optional<String> getTaskOpts() {
- Optional<String> jvmOpts =
Optional.ofNullable(get(ShellCommandConfig.TASK_JVM_OPTS));
- Optional<String> maxHeapMbOptional =
Optional.ofNullable(get(JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB));
- if (new JobConfig(this).getAutosizingEnabled() &&
maxHeapMbOptional.isPresent()) {
- String maxHeapMb = maxHeapMbOptional.get();
- String xmxSetting = "-Xmx" + maxHeapMb + "m";
- if (jvmOpts.isPresent() && jvmOpts.get().contains("-Xmx")) {
- jvmOpts = Optional.of(jvmOpts.get().replaceAll("-Xmx\\S+",
xmxSetting));
- } else if (jvmOpts.isPresent()) {
- jvmOpts = Optional.of(jvmOpts.get().concat(" " + xmxSetting));
- } else {
- jvmOpts = Optional.of(xmxSetting);
- }
- }
- return jvmOpts;
+ String taskOpts = get(ShellCommandConfig.TASK_JVM_OPTS);
+ String autosizingContainerMaxHeap =
get(JobConfig.JOB_AUTOSIZING_CONTAINER_MAX_HEAP_MB);
+
+ return Optional.ofNullable(getFinalJvmOptions(taskOpts,
autosizingContainerMaxHeap));
+ }
+
+ public Optional<String> getWorkerOpts() {
Review Comment:
Done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]