From 7586710d49ea86a22798a3f401a875e2f8669dbc Mon Sep 17 00:00:00 2001 From: QuantumXiecao <99702568+QuantumXiecao@users.noreply.github.com> Date: Tue, 28 Feb 2023 14:17:54 +0800 Subject: [PATCH] [fix-13625] Modify systemd-run from MemoryMax to MemoryLimit for more generality (#13627) Co-authored-by: xiecao --- .../plugin/task/api/AbstractCommandExecutor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java index c3e9b952ad..c80898744b 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java @@ -155,7 +155,7 @@ public abstract class AbstractCommandExecutor { /** * generate systemd command. - * eg: sudo systemd-run -q --scope -p CPUQuota=100% -p MemoryMax=200M --uid=root + * eg: sudo systemd-run -q --scope -p CPUQuota=100% -p MemoryLimit=200M --uid=root * @param command command */ private void generateCgroupCommand(List command) { @@ -175,12 +175,13 @@ public abstract class AbstractCommandExecutor { command.add(String.format("CPUQuota=%s%%", taskRequest.getCpuQuota())); } + // use `man systemd.resource-control` to find available parameter if (memoryMax == -1) { command.add("-p"); - command.add(String.format("MemoryMax=%s", "infinity")); + command.add(String.format("MemoryLimit=%s", "infinity")); } else { command.add("-p"); - command.add(String.format("MemoryMax=%sM", taskRequest.getMemoryMax())); + command.add(String.format("MemoryLimit=%sM", taskRequest.getMemoryMax())); } command.add(String.format("--uid=%s", taskRequest.getTenantCode()));