You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/11/08 02:44:23 UTC
[dolphinscheduler] branch 3.1.1-release updated: Add switch for checkOwn (#197) (#12803)
This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch 3.1.1-release
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/3.1.1-release by this push:
new fe3e93861f Add switch for checkOwn (#197) (#12803)
fe3e93861f is described below
commit fe3e93861f22b0b3e04327f51372bea86056e899
Author: Wenjun Ruan <we...@apache.org>
AuthorDate: Tue Nov 8 10:44:17 2022 +0800
Add switch for checkOwn (#197) (#12803)
---
.../java/org/apache/dolphinscheduler/common/constants/Constants.java | 2 ++
dolphinscheduler-common/src/main/resources/common.properties | 1 +
.../java/org/apache/dolphinscheduler/service/utils/CommonUtils.java | 4 ++++
.../server/worker/utils/TaskExecutionCheckerUtils.java | 2 +-
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java
index 42488f4869..5fe6888809 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java
+++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java
@@ -137,6 +137,8 @@ public final class Constants {
*/
public static final String SUDO_ENABLE = "sudo.enable";
+ public static final String SET_TASK_DIR_TO_TENANT_ENABLE = "setTaskDirToTenant.enable";
+
/**
* resource storage type
*/
diff --git a/dolphinscheduler-common/src/main/resources/common.properties b/dolphinscheduler-common/src/main/resources/common.properties
index 8a266ab9d1..3f6080090d 100644
--- a/dolphinscheduler-common/src/main/resources/common.properties
+++ b/dolphinscheduler-common/src/main/resources/common.properties
@@ -96,6 +96,7 @@ support.hive.oneSession=false
# use sudo or not, if set true, executing user is tenant user and deploy user needs sudo permissions; if set false, executing user is the deploy user and doesn't need sudo permissions
sudo.enable=true
+setTaskDirToTenant.enable=false
# network interface preferred like eth0, default: empty
#dolphin.scheduler.network.interface.preferred=
diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java
index 1345e71867..c5d1faf98a 100644
--- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java
+++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java
@@ -73,6 +73,10 @@ public class CommonUtils {
return PropertyUtils.getBoolean(Constants.DEVELOPMENT_STATE, true);
}
+ public static boolean isSetTaskDirToTenantEnable() {
+ return PropertyUtils.getBoolean(Constants.SET_TASK_DIR_TO_TENANT_ENABLE, false);
+ }
+
/**
* if upload resource is HDFS and kerberos startup is true , else false
*
diff --git a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java
index 875db06dbb..5c1a92616d 100644
--- a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java
+++ b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java
@@ -145,7 +145,7 @@ public class TaskExecutionCheckerUtils {
}
try {
Files.createDirectories(filePath);
- if (!OSUtils.isSudoEnable()) {
+ if (!CommonUtils.isSetTaskDirToTenantEnable()) {
// we need to open sudo, then we can change the owner.
return;
}