Browse Source

Add switch for checkOwn (#197) (#12803)

3.1.1-release
Wenjun Ruan 2 years ago committed by GitHub
parent
commit
fe3e93861f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java
  2. 1
      dolphinscheduler-common/src/main/resources/common.properties
  3. 4
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/CommonUtils.java
  4. 2
      dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java

2
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 SUDO_ENABLE = "sudo.enable";
public static final String SET_TASK_DIR_TO_TENANT_ENABLE = "setTaskDirToTenant.enable";
/** /**
* resource storage type * resource storage type
*/ */

1
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 # 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 sudo.enable=true
setTaskDirToTenant.enable=false
# network interface preferred like eth0, default: empty # network interface preferred like eth0, default: empty
#dolphin.scheduler.network.interface.preferred= #dolphin.scheduler.network.interface.preferred=

4
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); 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 * if upload resource is HDFS and kerberos startup is true , else false
* *

2
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionCheckerUtils.java

@ -145,7 +145,7 @@ public class TaskExecutionCheckerUtils {
} }
try { try {
Files.createDirectories(filePath); Files.createDirectories(filePath);
if (!OSUtils.isSudoEnable()) { if (!CommonUtils.isSetTaskDirToTenantEnable()) {
// we need to open sudo, then we can change the owner. // we need to open sudo, then we can change the owner.
return; return;
} }

Loading…
Cancel
Save