Skip to content

Commit fe3e938

Browse files
authored
Add switch for checkOwn (#197) (#12803)
1 parent 145c5ac commit fe3e938

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

Diff for: dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ private Constants() {
137137
*/
138138
public static final String SUDO_ENABLE = "sudo.enable";
139139

140+
public static final String SET_TASK_DIR_TO_TENANT_ENABLE = "setTaskDirToTenant.enable";
141+
140142
/**
141143
* resource storage type
142144
*/

Diff for: dolphinscheduler-common/src/main/resources/common.properties

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ support.hive.oneSession=false
9696

9797
# 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
9898
sudo.enable=true
99+
setTaskDirToTenant.enable=false
99100

100101
# network interface preferred like eth0, default: empty
101102
#dolphin.scheduler.network.interface.preferred=

Diff for: dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java

+4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public static boolean isDevelopMode() {
7373
return PropertyUtils.getBoolean(Constants.DEVELOPMENT_STATE, true);
7474
}
7575

76+
public static boolean isSetTaskDirToTenantEnable() {
77+
return PropertyUtils.getBoolean(Constants.SET_TASK_DIR_TO_TENANT_ENABLE, false);
78+
}
79+
7680
/**
7781
* if upload resource is HDFS and kerberos startup is true , else false
7882
*

Diff for: dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private static void createDirectoryWithOwner(Path filePath, String tenant) {
145145
}
146146
try {
147147
Files.createDirectories(filePath);
148-
if (!OSUtils.isSudoEnable()) {
148+
if (!CommonUtils.isSetTaskDirToTenantEnable()) {
149149
// we need to open sudo, then we can change the owner.
150150
return;
151151
}

0 commit comments

Comments
 (0)