Browse Source

Merge pull request #3 from apache/dev

update
pull/2/head
samz406 5 years ago committed by GitHub
parent
commit
4bb044a41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
  2. 9
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java
  3. 16
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
  4. 10
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
  5. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  6. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
  7. 27
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
  8. 12
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ResInfo.java
  9. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java
  10. 125
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/StringUtils.java
  11. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java
  12. 8
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java
  13. 43
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ResInfoTest.java
  14. 4
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ScriptRunnerTest.java
  15. 66
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/StringUtilsTest.java
  16. 48
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java
  17. 20
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  18. 17
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/dependent.vue
  19. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  20. 29
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
  21. 25
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/procedure.vue
  22. 32
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  23. 34
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  24. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
  25. 10
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue
  26. 7
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
  27. 1
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  28. 1
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
  29. 1
      pom.xml
  30. 1
      sql/dolphinscheduler-postgre.sql
  31. 1
      sql/dolphinscheduler_mysql.sql
  32. 37
      sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql
  33. 12
      sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_dml.sql
  34. 34
      sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql
  35. 16
      sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_dml.sql

8
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java

@ -90,14 +90,14 @@ public class MailUtils {
public static Map<String,Object> sendMails(Collection<String> receivers, Collection<String> receiversCc, String title, String content, ShowType showType) { public static Map<String,Object> sendMails(Collection<String> receivers, Collection<String> receiversCc, String title, String content, ShowType showType) {
Map<String,Object> retMap = new HashMap<>(); Map<String,Object> retMap = new HashMap<>();
retMap.put(Constants.STATUS, false); retMap.put(Constants.STATUS, false);
// if there is no receivers && no receiversCc, no need to process // if there is no receivers && no receiversCc, no need to process
if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiversCc)) { if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiversCc)) {
return retMap; return retMap;
} }
receivers.removeIf(StringUtils::isEmpty); receivers.removeIf(StringUtils::isEmpty);
if (showType == ShowType.TABLE || showType == ShowType.TEXT){ if (showType == ShowType.TABLE || showType == ShowType.TEXT){
// send email // send email
HtmlEmail email = new HtmlEmail(); HtmlEmail email = new HtmlEmail();
@ -335,7 +335,7 @@ public class MailUtils {
*/ */
private static void handleException(Collection<String> receivers, Map<String, Object> retMap, Exception e) { private static void handleException(Collection<String> receivers, Map<String, Object> retMap, Exception e) {
logger.error("Send email to {} failed {}", receivers, e); logger.error("Send email to {} failed {}", receivers, e);
retMap.put(Constants.MESSAGE, "Send email to {" + StringUtils.join(receivers, ",") + "} failed," + e.toString()); retMap.put(Constants.MESSAGE, "Send email to {" + String.join(",", receivers) + "} failed," + e.toString());
} }
} }

9
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java

@ -157,8 +157,7 @@ public class BaseController {
* @return success result code * @return success result code
*/ */
public Result success(String msg, Object list) { public Result success(String msg, Object list) {
Result result = getResult(msg, list); return getResult(msg, list);
return result;
} }
/** /**
@ -168,8 +167,7 @@ public class BaseController {
* @return success result code * @return success result code
*/ */
public Result success(Object list) { public Result success(Object list) {
Result result = getResult(Status.SUCCESS.getMsg(), list); return getResult(Status.SUCCESS.getMsg(), list);
return result;
} }
/** /**
@ -181,8 +179,7 @@ public class BaseController {
* @return success result code * @return success result code
*/ */
public Result success(String msg, Map<String, Object> object) { public Result success(String msg, Map<String, Object> object) {
Result result = getResult(msg, object); return getResult(msg, object);
return result;
} }
/** /**

16
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java

@ -53,7 +53,7 @@ public class ProcessDefinitionController extends BaseController{
/** /**
* create process definition * create process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
* @param name process definition name * @param name process definition name
@ -96,7 +96,7 @@ public class ProcessDefinitionController extends BaseController{
/** /**
* verify process definition name unique * verify process definition name unique
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
* @param name name * @param name name
@ -328,9 +328,9 @@ public class ProcessDefinitionController extends BaseController{
/** /**
* *
* get tasks list by process definition id * get tasks list by process definition id
* *
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
@ -442,7 +442,7 @@ public class ProcessDefinitionController extends BaseController{
loginUser.getUserName(), projectName, processDefinitionIds); loginUser.getUserName(), projectName, processDefinitionIds);
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
List<Integer> deleteFailedIdList = new ArrayList<Integer>(); List<String> deleteFailedIdList = new ArrayList<>();
if(StringUtils.isNotEmpty(processDefinitionIds)){ if(StringUtils.isNotEmpty(processDefinitionIds)){
String[] processDefinitionIdArray = processDefinitionIds.split(","); String[] processDefinitionIdArray = processDefinitionIds.split(",");
@ -451,17 +451,17 @@ public class ProcessDefinitionController extends BaseController{
try { try {
Map<String, Object> deleteResult = processDefinitionService.deleteProcessDefinitionById(loginUser, projectName, processDefinitionId); Map<String, Object> deleteResult = processDefinitionService.deleteProcessDefinitionById(loginUser, projectName, processDefinitionId);
if(!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))){ if(!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))){
deleteFailedIdList.add(processDefinitionId); deleteFailedIdList.add(strProcessDefinitionId);
logger.error((String)deleteResult.get(Constants.MSG)); logger.error((String)deleteResult.get(Constants.MSG));
} }
} catch (Exception e) { } catch (Exception e) {
deleteFailedIdList.add(processDefinitionId); deleteFailedIdList.add(strProcessDefinitionId);
} }
} }
} }
if(!deleteFailedIdList.isEmpty()){ if(!deleteFailedIdList.isEmpty()){
putMsg(result, Status.BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR,StringUtils.join(deleteFailedIdList,",")); putMsg(result, Status.BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR, String.join(",", deleteFailedIdList));
}else{ }else{
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
} }

10
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java

@ -58,7 +58,7 @@ public class ProcessInstanceController extends BaseController{
/** /**
* query process instance list paging * query process instance list paging
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
* @param pageNo page number * @param pageNo page number
@ -372,7 +372,7 @@ public class ProcessInstanceController extends BaseController{
// task queue // task queue
ITaskQueue tasksQueue = TaskQueueFactory.getTaskQueueInstance(); ITaskQueue tasksQueue = TaskQueueFactory.getTaskQueueInstance();
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
List<Integer> deleteFailedIdList = new ArrayList<Integer>(); List<String> deleteFailedIdList = new ArrayList<>();
if(StringUtils.isNotEmpty(processInstanceIds)){ if(StringUtils.isNotEmpty(processInstanceIds)){
String[] processInstanceIdArray = processInstanceIds.split(","); String[] processInstanceIdArray = processInstanceIds.split(",");
@ -381,16 +381,16 @@ public class ProcessInstanceController extends BaseController{
try { try {
Map<String, Object> deleteResult = processInstanceService.deleteProcessInstanceById(loginUser, projectName, processInstanceId,tasksQueue); Map<String, Object> deleteResult = processInstanceService.deleteProcessInstanceById(loginUser, projectName, processInstanceId,tasksQueue);
if(!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))){ if(!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))){
deleteFailedIdList.add(processInstanceId); deleteFailedIdList.add(strProcessInstanceId);
logger.error((String)deleteResult.get(Constants.MSG)); logger.error((String)deleteResult.get(Constants.MSG));
} }
} catch (Exception e) { } catch (Exception e) {
deleteFailedIdList.add(processInstanceId); deleteFailedIdList.add(strProcessInstanceId);
} }
} }
} }
if(deleteFailedIdList.size() > 0){ if(deleteFailedIdList.size() > 0){
putMsg(result, Status.BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR,StringUtils.join(deleteFailedIdList,",")); putMsg(result, Status.BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR, String.join(",", deleteFailedIdList));
}else{ }else{
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
} }

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java

@ -143,6 +143,7 @@ public class ProcessDefinitionService extends BaseDAGService {
processDefine.setConnects(connects); processDefine.setConnects(connects);
processDefine.setTimeout(processData.getTimeout()); processDefine.setTimeout(processData.getTimeout());
processDefine.setTenantId(processData.getTenantId()); processDefine.setTenantId(processData.getTenantId());
processDefine.setModifyBy(loginUser.getUserName());
//custom global params //custom global params
List<Property> globalParamsList = processData.getGlobalParams(); List<Property> globalParamsList = processData.getGlobalParams();
@ -308,6 +309,7 @@ public class ProcessDefinitionService extends BaseDAGService {
processDefine.setConnects(connects); processDefine.setConnects(connects);
processDefine.setTimeout(processData.getTimeout()); processDefine.setTimeout(processData.getTimeout());
processDefine.setTenantId(processData.getTenantId()); processDefine.setTenantId(processData.getTenantId());
processDefine.setModifyBy(loginUser.getUserName());
//custom global params //custom global params
List<Property> globalParamsList = new ArrayList<>(); List<Property> globalParamsList = new ArrayList<>();

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java

@ -539,7 +539,7 @@ public class ResourcesService extends BaseService {
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put(ALIAS, resource.getAlias()); map.put(ALIAS, resource.getAlias());
map.put(CONTENT, StringUtils.join(content, "\n")); map.put(CONTENT, String.join("\n", content));
result.setData(map); result.setData(map);
}else{ }else{
logger.error("read file {} not exist in hdfs", hdfsFileName); logger.error("read file {} not exist in hdfs", hdfsFileName);

27
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java

@ -27,6 +27,7 @@ import org.apache.dolphinscheduler.common.enums.*;
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.*; import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*; import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
@ -77,6 +78,9 @@ public class ProcessDefinitionServiceTest {
@Mock @Mock
private WorkerGroupMapper workerGroupMapper; private WorkerGroupMapper workerGroupMapper;
@Mock
private ProcessDao processDao;
private String sqlDependentJson = "{\"globalParams\":[]," + private String sqlDependentJson = "{\"globalParams\":[]," +
"\"tasks\":[{\"type\":\"SQL\",\"id\":\"tasks-27297\",\"name\":\"sql\"," + "\"tasks\":[{\"type\":\"SQL\",\"id\":\"tasks-27297\",\"name\":\"sql\"," +
"\"params\":{\"type\":\"MYSQL\",\"datasource\":1,\"sql\":\"select * from test\"," + "\"params\":{\"type\":\"MYSQL\",\"datasource\":1,\"sql\":\"select * from test\"," +
@ -422,6 +426,27 @@ public class ProcessDefinitionServiceTest {
Assert.assertTrue(deleteFlag); Assert.assertTrue(deleteFlag);
} }
@Test
public void testUpdateProcessDefinition () {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = new HashMap<>(5);
putMsg(result, Status.SUCCESS);
String projectName = "project_test1";
Project project = getProject(projectName);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
Mockito.when(processDao.findProcessDefineById(1)).thenReturn(getProcessDefinition());
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectName, 1, "test",
sqlDependentJson, "", "", "");
Assert.assertEquals(Status.UPDATE_PROCESS_DEFINITION_ERROR, updateResult.get(Constants.STATUS));
}
/** /**
* get mock datasource * get mock datasource
@ -443,6 +468,8 @@ public class ProcessDefinitionServiceTest {
processDefinition.setId(46); processDefinition.setId(46);
processDefinition.setName("testProject"); processDefinition.setName("testProject");
processDefinition.setProjectId(2); processDefinition.setProjectId(2);
processDefinition.setTenantId(1);
processDefinition.setDescription("");
return processDefinition; return processDefinition;
} }

12
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ResInfo.java

@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.common.utils; package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.model.Server;
@ -135,14 +134,15 @@ public class ResInfo {
* @return heartbeat info to Server * @return heartbeat info to Server
*/ */
public static Server parseHeartbeatForZKInfo(String heartBeatInfo){ public static Server parseHeartbeatForZKInfo(String heartBeatInfo){
Server masterServer = null; if (StringUtils.isEmpty(heartBeatInfo)) {
return null;
}
String[] masterArray = heartBeatInfo.split(Constants.COMMA); String[] masterArray = heartBeatInfo.split(Constants.COMMA);
if(masterArray == null || if(masterArray.length != Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH){
masterArray.length != Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH){ return null;
return masterServer;
} }
masterServer = new Server(); Server masterServer = new Server();
masterServer.setHost(masterArray[0]); masterServer.setHost(masterArray[0]);
masterServer.setPort(Integer.parseInt(masterArray[1])); masterServer.setPort(Integer.parseInt(masterArray[1]));
masterServer.setResInfo(getResInfoJson(Double.parseDouble(masterArray[2]), masterServer.setResInfo(getResInfoJson(Double.parseDouble(masterArray[2]),

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java

@ -169,13 +169,13 @@ public class ScriptRunner {
if (stopOnError && rs != null) { if (stopOnError && rs != null) {
ResultSetMetaData md = rs.getMetaData(); ResultSetMetaData md = rs.getMetaData();
int cols = md.getColumnCount(); int cols = md.getColumnCount();
for (int i = 0; i < cols; i++) { for (int i = 1; i < cols; i++) {
String name = md.getColumnLabel(i); String name = md.getColumnLabel(i);
logger.info("{} \t", name); logger.info("{} \t", name);
} }
logger.info(""); logger.info("");
while (rs.next()) { while (rs.next()) {
for (int i = 0; i < cols; i++) { for (int i = 1; i < cols; i++) {
String value = rs.getString(i); String value = rs.getString(i);
logger.info("{} \t", value); logger.info("{} \t", value);
} }

125
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/StringUtils.java

@ -16,17 +16,7 @@
*/ */
package org.apache.dolphinscheduler.common.utils; package org.apache.dolphinscheduler.common.utils;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.Objects;
import java.util.regex.Pattern;
public class StringUtils { public class StringUtils {
public static final int INDEX_NOT_FOUND = -1;
public static final String EMPTY = ""; public static final String EMPTY = "";
public static boolean isEmpty(final CharSequence cs) { public static boolean isEmpty(final CharSequence cs) {
@ -37,119 +27,14 @@ public class StringUtils {
return !isEmpty(cs); return !isEmpty(cs);
} }
public static boolean isBlank(CharSequence cs){ public static boolean isBlank(String s){
int strLen; if (isEmpty(s)) {
if (cs == null || (strLen = cs.length()) == 0) {
return true; return true;
} }
for (int i = 0; i < strLen; i++) { return s.trim().length() == 0;
if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
}
}
return true;
}
public static boolean isNotBlank(CharSequence str){
return !isBlank(str);
}
public static String substringBefore(final String str, final String separator) {
if (isBlank(str) || separator == null) {
return str;
}
if (separator.isEmpty()) {
return EMPTY;
}
final int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
return str.substring(0, pos);
}
public static String substringAfter(final String str, final String separator) {
if (isBlank(str)) {
return str;
}
if (separator == null) {
return EMPTY;
}
final int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return EMPTY;
}
return str.substring(pos + separator.length());
} }
public static String substringAfterLast(final String str, final String separator) { public static boolean isNotBlank(String s){
if (isEmpty(str)) { return !isBlank(s);
return str;
}
if (isEmpty(separator)) {
return EMPTY;
}
final int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
return EMPTY;
}
return str.substring(pos + separator.length());
}
public static String getUtf8String(byte[] bytes){
return new String(bytes, StandardCharsets.UTF_8);
}
public static byte[] getUtf8Bytes(String str){
return str.getBytes(StandardCharsets.UTF_8);
}
public static boolean hasChinese(String str) {
if (str == null) {
return false;
}
Pattern pattern = Pattern.compile("[\\u4E00-\\u9FBF]+");
return pattern.matcher(str).find();
}
public static boolean hasSpace(String str) {
if (str == null) {
return false;
}
int len = str.length();
for (int i = 0; i < len; i++) {
if (str.charAt(i) == ' ') {
return true;
}
}
return false;
}
public static String join(final Iterable<?> iterable, final String separator){
Iterator<?> iterator = iterable.iterator();
if (iterator == null) {
return null;
}
if (!iterator.hasNext()) {
return EMPTY;
}
final Object first = iterator.next();
if (!iterable.iterator().hasNext()) {
return Objects.toString(first, "");
}
final StringBuilder buf = new StringBuilder(64);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
if (separator != null) {
buf.append(separator);
}
final Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
} }
} }

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java

@ -33,7 +33,9 @@ import static org.apache.commons.lang.time.DateUtils.addDays;
* business time utils * business time utils
*/ */
public class BusinessTimeUtils { public class BusinessTimeUtils {
private BusinessTimeUtils() {
throw new IllegalStateException("BusinessTimeUtils class");
}
/** /**
* get business time in parameters by different command types * get business time in parameters by different command types
* *

8
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java

@ -17,12 +17,12 @@
package org.apache.dolphinscheduler.common.queue; package org.apache.dolphinscheduler.common.queue;
import org.apache.dolphinscheduler.common.zk.ZKServer; import org.apache.dolphinscheduler.common.zk.ZKServer;
import org.junit.AfterClass; import org.junit.*;
import org.junit.BeforeClass;
/** /**
* base task queue test for only start zk server once * base task queue test for only start zk server once
*/ */
@Ignore
public class BaseTaskQueueTest { public class BaseTaskQueueTest {
protected static ITaskQueue tasksQueue = null; protected static ITaskQueue tasksQueue = null;
@ -40,4 +40,8 @@ public class BaseTaskQueueTest {
tasksQueue.delete(); tasksQueue.delete();
ZKServer.stop(); ZKServer.stop();
} }
@Test
public void tasksQueueNotNull(){
Assert.assertNotNull(tasksQueue);
}
} }

43
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ResInfoTest.java

@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.junit.Assert;
import org.junit.Test;
import java.util.Date;
import org.apache.dolphinscheduler.common.model.Server;
public class ResInfoTest {
@Test
public void testGetHeartBeatInfo() {
String info = ResInfo.getHeartBeatInfo(new Date());
Assert.assertEquals(7, info.split(",").length);
}
@Test
public void testParseHeartbeatForZKInfo() {
//normal info
String info = ResInfo.getHeartBeatInfo(new Date());
Server s = ResInfo.parseHeartbeatForZKInfo(info);
Assert.assertNotNull(s);
Assert.assertNotNull(s.getResInfo());
//null param
s = ResInfo.parseHeartbeatForZKInfo(null);
Assert.assertNull(s);
}
}

4
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ScriptRunnerTest.java

@ -48,7 +48,7 @@ public class ScriptRunnerTest {
Mockito.when(st.getResultSet()).thenReturn(rs); Mockito.when(st.getResultSet()).thenReturn(rs);
ResultSetMetaData md = Mockito.mock(ResultSetMetaData.class); ResultSetMetaData md = Mockito.mock(ResultSetMetaData.class);
Mockito.when(rs.getMetaData()).thenReturn(md); Mockito.when(rs.getMetaData()).thenReturn(md);
Mockito.when(md.getColumnCount()).thenReturn(1); Mockito.when(md.getColumnCount()).thenReturn(2);
Mockito.when(rs.next()).thenReturn(true, false); Mockito.when(rs.next()).thenReturn(true, false);
ScriptRunner s = new ScriptRunner(conn, true, true); ScriptRunner s = new ScriptRunner(conn, true, true);
if (dbName.isEmpty()) { if (dbName.isEmpty()) {
@ -56,7 +56,7 @@ public class ScriptRunnerTest {
} else { } else {
s.runScript(new StringReader("select 1;"), dbName); s.runScript(new StringReader("select 1;"), dbName);
} }
Mockito.verify(md).getColumnLabel(0); Mockito.verify(md).getColumnLabel(1);
} catch(Exception e) { } catch(Exception e) {
Assert.assertNotNull(e); Assert.assertNotNull(e);
} }

66
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/StringUtilsTest.java

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
public class StringUtilsTest {
@Test
public void testIsNotEmpty() {
//null string
boolean b = StringUtils.isNotEmpty(null);
Assert.assertFalse(b);
//"" string
b = StringUtils.isNotEmpty("");
Assert.assertFalse(b);
//" " string
b = StringUtils.isNotEmpty(" ");
Assert.assertTrue(b);
//"test" string
b = StringUtils.isNotEmpty("test");
Assert.assertTrue(b);
}
@Test
public void testIsNotBlank() {
//null string
boolean b = StringUtils.isNotBlank(null);
Assert.assertFalse(b);
//"" string
b = StringUtils.isNotBlank("");
Assert.assertFalse(b);
//" " string
b = StringUtils.isNotBlank(" ");
Assert.assertFalse(b);
//" test " string
b = StringUtils.isNotBlank(" test ");
Assert.assertTrue(b);
//"test" string
b = StringUtils.isNotBlank("test");
Assert.assertTrue(b);
}
}

48
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java

@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -158,6 +159,11 @@ public class ProcessDefinition {
*/ */
private int tenantId; private int tenantId;
/**
* modify user name
*/
private String modifyBy;
public String getName() { public String getName() {
return name; return name;
@ -337,6 +343,30 @@ public class ProcessDefinition {
this.timeout = timeout; this.timeout = timeout;
} }
public int getTenantId() {
return tenantId;
}
public void setTenantId(int tenantId) {
this.tenantId = tenantId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
@Override @Override
public String toString() { public String toString() {
return "ProcessDefinition{" + return "ProcessDefinition{" +
@ -346,6 +376,7 @@ public class ProcessDefinition {
", releaseState=" + releaseState + ", releaseState=" + releaseState +
", projectId=" + projectId + ", projectId=" + projectId +
", processDefinitionJson='" + processDefinitionJson + '\'' + ", processDefinitionJson='" + processDefinitionJson + '\'' +
", description='" + description + '\'' +
", globalParams='" + globalParams + '\'' + ", globalParams='" + globalParams + '\'' +
", globalParamList=" + globalParamList + ", globalParamList=" + globalParamList +
", globalParamMap=" + globalParamMap + ", globalParamMap=" + globalParamMap +
@ -362,22 +393,7 @@ public class ProcessDefinition {
", scheduleReleaseState=" + scheduleReleaseState + ", scheduleReleaseState=" + scheduleReleaseState +
", timeout=" + timeout + ", timeout=" + timeout +
", tenantId=" + tenantId + ", tenantId=" + tenantId +
", modifyBy='" + modifyBy + '\'' +
'}'; '}';
} }
public int getTenantId() {
return tenantId;
}
public void setTenantId(int tenantId) {
this.tenantId = tenantId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
} }

20
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -121,6 +121,7 @@
<m-shell <m-shell
v-if="taskType === 'SHELL'" v-if="taskType === 'SHELL'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
ref="SHELL" ref="SHELL"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
</m-shell> </m-shell>
@ -128,6 +129,7 @@
<m-sub-process <m-sub-process
v-if="taskType === 'SUB_PROCESS'" v-if="taskType === 'SUB_PROCESS'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
@on-set-process-name="_onSetProcessName" @on-set-process-name="_onSetProcessName"
ref="SUB_PROCESS" ref="SUB_PROCESS"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
@ -136,6 +138,7 @@
<m-procedure <m-procedure
v-if="taskType === 'PROCEDURE'" v-if="taskType === 'PROCEDURE'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
ref="PROCEDURE" ref="PROCEDURE"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
</m-procedure> </m-procedure>
@ -167,6 +170,7 @@
<m-mr <m-mr
v-if="taskType === 'MR'" v-if="taskType === 'MR'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
ref="MR" ref="MR"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
</m-mr> </m-mr>
@ -174,6 +178,7 @@
<m-python <m-python
v-if="taskType === 'PYTHON'" v-if="taskType === 'PYTHON'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
ref="PYTHON" ref="PYTHON"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
</m-python> </m-python>
@ -181,6 +186,7 @@
<m-dependent <m-dependent
v-if="taskType === 'DEPENDENT'" v-if="taskType === 'DEPENDENT'"
@on-dependent="_onDependent" @on-dependent="_onDependent"
@on-cache-dependent="_onCacheDependent"
ref="DEPENDENT" ref="DEPENDENT"
:backfill-item="backfillItem"> :backfill-item="backfillItem">
</m-dependent> </m-dependent>
@ -248,6 +254,8 @@
resourcesList: [], resourcesList: [],
// dependence // dependence
dependence: {}, dependence: {},
// cache dependence
cacheDependence: {},
// Current node params data // Current node params data
params: {}, params: {},
// Running sign // Running sign
@ -283,6 +291,12 @@
_onDependent (o) { _onDependent (o) {
this.dependence = Object.assign(this.dependence, {}, o) this.dependence = Object.assign(this.dependence, {}, o)
}, },
/**
* cache dependent
*/
_onCacheDependent (o) {
this.cacheDependence = Object.assign(this.cacheDependence, {}, o)
},
/** /**
* Task timeout alarm * Task timeout alarm
*/ */
@ -356,9 +370,10 @@
type: this.taskType, type: this.taskType,
id: this.id, id: this.id,
name: this.name, name: this.name,
params: this.params,
description: this.description, description: this.description,
runFlag: this.runFlag, runFlag: this.runFlag,
dependence: this.dependence, dependence: this.cacheDependence,
maxRetryTimes: this.maxRetryTimes, maxRetryTimes: this.maxRetryTimes,
retryInterval: this.retryInterval, retryInterval: this.retryInterval,
timeout: this.timeout, timeout: this.timeout,
@ -522,6 +537,7 @@
this.params = o.params || {} this.params = o.params || {}
this.dependence = o.dependence || {} this.dependence = o.dependence || {}
this.cacheDependence = o.dependence || {}
} }
this.isContentBox = true this.isContentBox = true
@ -551,7 +567,7 @@
name: this.name, name: this.name,
description: this.description, description: this.description,
runFlag: this.runFlag, runFlag: this.runFlag,
dependence: this.dependence, dependence: this.cacheDependence,
maxRetryTimes: this.maxRetryTimes, maxRetryTimes: this.maxRetryTimes,
retryInterval: this.retryInterval, retryInterval: this.retryInterval,
timeout: this.timeout, timeout: this.timeout,

17
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/dependent.vue

@ -131,6 +131,9 @@
setTimeout(() => { setTimeout(() => {
this.isLoading = false this.isLoading = false
}, 600) }, 600)
},
cacheDependence (val) {
this.$emit('on-cache-dependent', val)
} }
}, },
beforeCreate () { beforeCreate () {
@ -151,7 +154,19 @@
}, },
destroyed () { destroyed () {
}, },
computed: {}, computed: {
cacheDependence () {
return {
relation: this.relation,
dependTaskList: _.map(this.dependTaskList, v => {
return {
relation: v.relation,
dependItemList: _.map(v.dependItemList, v1 => _.omit(v1, ['depTasksList', 'state', 'dateValueList']))
}
})
}
}
},
components: { mListBox, mDependItemList } components: { mListBox, mDependItemList }
} }
</script> </script>

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -379,7 +379,7 @@
// Non-null objects represent backfill // Non-null objects represent backfill
if (!_.isEmpty(o)) { if (!_.isEmpty(o)) {
this.mainClass = o.params.mainClass || '' this.mainClass = o.params.mainClass || ''
this.mainJar = o.params.mainJar.res || '' this.mainJar = o.params.mainJar && o.params.mainJar.res ? o.params.mainJar.res : ''
this.deployMode = o.params.deployMode || '' this.deployMode = o.params.deployMode || ''
this.slot = o.params.slot || 1 this.slot = o.params.slot || 1
this.taskManager = o.params.taskManager || '2' this.taskManager = o.params.taskManager || '2'

29
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue

@ -91,6 +91,7 @@
<m-resources <m-resources
ref="refResources" ref="refResources"
@on-resourcesData="_onResourcesData" @on-resourcesData="_onResourcesData"
@on-cache-resourcesData="_onCacheResourcesData"
:resource-list="resourceList"> :resource-list="resourceList">
</m-resources> </m-resources>
</div> </div>
@ -127,6 +128,8 @@
mainJarList: [], mainJarList: [],
// Resource(list) // Resource(list)
resourceList: [], resourceList: [],
// Cache ResourceList
cacheResourceList: [],
// Custom parameter // Custom parameter
localParams: [], localParams: [],
// Command line argument // Command line argument
@ -156,6 +159,12 @@
_onResourcesData (a) { _onResourcesData (a) {
this.resourceList = a this.resourceList = a
}, },
/**
* cache resourceList
*/
_onCacheResourcesData (a) {
this.cacheResourceList = a
},
/** /**
* verification * verification
*/ */
@ -220,6 +229,25 @@
if (type === 'PYTHON') { if (type === 'PYTHON') {
this.mainClass = '' this.mainClass = ''
} }
},
//Watch the cacheParams
cacheParams (val) {
this.$emit('on-cache-params', val);
}
},
computed: {
cacheParams () {
return {
mainClass: this.mainClass,
mainJar: {
res: this.mainJar
},
resourceList: this.cacheResourceList,
localParams: this.localParams,
mainArgs: this.mainArgs,
others: this.others,
programType: this.programType
}
} }
}, },
created () { created () {
@ -238,6 +266,7 @@
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = resourceList this.resourceList = resourceList
this.cacheResourceList = resourceList
} }
// backfill localParams // backfill localParams

25
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/procedure.vue

@ -70,7 +70,9 @@
// Data source type // Data source type
type: '', type: '',
// data source // data source
datasource: '' datasource: '',
// Return to the selected data source
rtDatasource: ''
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -83,7 +85,7 @@
*/ */
_onDsData (o) { _onDsData (o) {
this.type = o.type this.type = o.type
this.datasource = o.datasource this.rtDatasource = o.datasource
}, },
/** /**
* return udp * return udp
@ -112,14 +114,29 @@
// storage // storage
this.$emit('on-params', { this.$emit('on-params', {
type: this.type, type: this.type,
datasource: this.datasource, datasource: this.rtDatasource,
method: this.method, method: this.method,
localParams: this.localParams localParams: this.localParams
}) })
return true return true
} }
}, },
watch: {}, watch: {
//Watch the cacheParams
cacheParams (val) {
this.$emit('on-cache-params', val);
}
},
computed: {
cacheParams () {
return {
type: this.type,
datasource: this.rtDatasource,
method: this.method,
localParams: this.localParams
}
}
},
created () { created () {
let o = this.backfillItem let o = this.backfillItem

32
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue

@ -31,6 +31,7 @@
<m-resources <m-resources
ref="refResources" ref="refResources"
@on-resourcesData="_onResourcesData" @on-resourcesData="_onResourcesData"
@on-cache-resourcesData="_onCacheResourcesData"
:resource-list="resourceList"> :resource-list="resourceList">
</m-resources> </m-resources>
</div> </div>
@ -69,7 +70,9 @@
// Custom parameter // Custom parameter
localParams: [], localParams: [],
// resource(list) // resource(list)
resourceList: [] resourceList: [],
// Cache ResourceList
cacheResourceList: []
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -89,6 +92,12 @@
_onResourcesData (a) { _onResourcesData (a) {
this.resourceList = a this.resourceList = a
}, },
/**
* cache resourceList
*/
_onCacheResourcesData (a) {
this.cacheResourceList = a
},
/** /**
* verification * verification
*/ */
@ -142,18 +151,33 @@
return editor return editor
} }
}, },
watch: {}, watch: {
//Watch the cacheParams
cacheParams (val) {
this.$emit('on-cache-params', val);
}
},
computed: {
cacheParams () {
return {
resourceList: this.cacheResourceList,
localParams: this.localParams,
rawScript: editor ? editor.getValue() : ''
}
}
},
created () { created () {
let o = this.backfillItem let o = this.backfillItem
// Non-null objects represent backfill // Non-null objects represent backfill
if (!_.isEmpty(o)) { if (!_.isEmpty(o)) {
this.rawScript = o.params.rawScript this.rawScript = o.params.rawScript || ''
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = resourceList this.resourceList = resourceList
this.cacheResourceList = resourceList
} }
// backfill localParams // backfill localParams
@ -174,4 +198,4 @@
}, },
components: { mLocalParams, mListBox, mResources } components: { mLocalParams, mListBox, mResources }
} }
</script> </script>

34
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue

@ -37,6 +37,7 @@
<m-resources <m-resources
ref="refResources" ref="refResources"
@on-resourcesData="_onResourcesData" @on-resourcesData="_onResourcesData"
@on-cache-resourcesData="_onCacheResourcesData"
:resource-list="resourceList"> :resource-list="resourceList">
</m-resources> </m-resources>
</div> </div>
@ -75,7 +76,9 @@
// Custom parameter // Custom parameter
localParams: [], localParams: [],
// resource(list) // resource(list)
resourceList: [] resourceList: [],
// Cache ResourceList
cacheResourceList: []
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -119,11 +122,17 @@
}, },
/** /**
* return resourceList * return resourceList
* *
*/ */
_onResourcesData (a) { _onResourcesData (a) {
this.resourceList = a this.resourceList = a
}, },
/**
* cache resourceList
*/
_onCacheResourcesData (a) {
this.cacheResourceList = a
},
/** /**
* verification * verification
*/ */
@ -175,18 +184,33 @@
return editor return editor
} }
}, },
watch: {}, watch: {
//Watch the cacheParams
cacheParams (val) {
this.$emit('on-cache-params', val);
}
},
computed: {
cacheParams () {
return {
resourceList: this.cacheResourceList,
localParams: this.localParams,
rawScript: editor ? editor.getValue() : ''
}
}
},
created () { created () {
let o = this.backfillItem let o = this.backfillItem
// Non-null objects represent backfill // Non-null objects represent backfill
if (!_.isEmpty(o)) { if (!_.isEmpty(o)) {
this.rawScript = o.params.rawScript this.rawScript = o.params.rawScript || ''
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = resourceList this.resourceList = resourceList
this.cacheResourceList = resourceList
} }
// backfill localParams // backfill localParams
@ -229,5 +253,5 @@
right: -12px; right: -12px;
top: -16px; top: -16px;
} }
</style> </style>

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue

@ -412,7 +412,7 @@
// Non-null objects represent backfill // Non-null objects represent backfill
if (!_.isEmpty(o)) { if (!_.isEmpty(o)) {
this.mainClass = o.params.mainClass || '' this.mainClass = o.params.mainClass || ''
this.mainJar = o.params.mainJar.res || '' this.mainJar = o.params.mainJar && o.params.mainJar.res ? o.params.mainJar.res : ''
this.deployMode = o.params.deployMode || '' this.deployMode = o.params.deployMode || ''
this.driverCores = o.params.driverCores || 1 this.driverCores = o.params.driverCores || 1
this.driverMemory = o.params.driverMemory || '512M' this.driverMemory = o.params.driverMemory || '512M'

10
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue

@ -86,7 +86,13 @@
return _.filter(this.processDefinitionList, v => id === v.id)[0].code return _.filter(this.processDefinitionList, v => id === v.id)[0].code
} }
}, },
watch: {}, watch: {
wdiCurr (val) {
this.$emit('on-cache-params', {
processDefinitionId: this.wdiCurr
})
}
},
created () { created () {
let processListS = _.cloneDeep(this.store.state.dag.processListS) let processListS = _.cloneDeep(this.store.state.dag.processListS)
let id = this.router.history.current.params.id || null let id = this.router.history.current.params.id || null
@ -115,4 +121,4 @@
mounted () { mounted () {
} }
} }
</script> </script>

7
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue

@ -40,6 +40,9 @@
<th scope="col"> <th scope="col">
<span>{{$t('Description')}}</span> <span>{{$t('Description')}}</span>
</th> </th>
<th scope="col" width="130">
<span>{{$t('Modify User')}}</span>
</th>
<th scope="col" width="90"> <th scope="col" width="90">
<span>{{$t('Timing state')}}</span> <span>{{$t('Timing state')}}</span>
</th> </th>
@ -72,6 +75,10 @@
<span v-if="item.description" class="ellipsis" v-tooltip.large.top.start.light="{text: item.description, maxWidth: '500px'}">{{item.description}}</span> <span v-if="item.description" class="ellipsis" v-tooltip.large.top.start.light="{text: item.description, maxWidth: '500px'}">{{item.description}}</span>
<span v-else>-</span> <span v-else>-</span>
</td> </td>
<td>
<span v-if="item.modifyBy">{{item.modifyBy}}</span>
<span v-else>-</span>
</td>
<td> <td>
<span v-if="item.scheduleReleaseState === 'OFFLINE'">{{$t('offline')}}</span> <span v-if="item.scheduleReleaseState === 'OFFLINE'">{{$t('offline')}}</span>
<span v-if="item.scheduleReleaseState === 'ONLINE'">{{$t('online')}}</span> <span v-if="item.scheduleReleaseState === 'ONLINE'">{{$t('online')}}</span>

1
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -518,4 +518,5 @@ export default {
'SpeedRecord': 'speed(record count)', 'SpeedRecord': 'speed(record count)',
'0 means unlimited by byte': '0 means unlimited', '0 means unlimited by byte': '0 means unlimited',
'0 means unlimited by count': '0 means unlimited', '0 means unlimited by count': '0 means unlimited',
'Modify User': 'Modify User'
} }

1
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -518,4 +518,5 @@ export default {
'SpeedRecord': '限流(记录数)', 'SpeedRecord': '限流(记录数)',
'0 means unlimited by byte': 'KB0代表不限制', '0 means unlimited by byte': 'KB0代表不限制',
'0 means unlimited by count': '0代表不限制', '0 means unlimited by count': '0代表不限制',
'Modify User': '修改用户'
} }

1
pom.xml

@ -343,6 +343,7 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version> <version>${mysql.connector.version}</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

1
sql/dolphinscheduler-postgre.sql

@ -319,6 +319,7 @@ CREATE TABLE t_ds_process_definition (
timeout int DEFAULT '0' , timeout int DEFAULT '0' ,
tenant_id int NOT NULL DEFAULT '-1' , tenant_id int NOT NULL DEFAULT '-1' ,
update_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL ,
modify_by varchar(36) DEFAULT '' ,
PRIMARY KEY (id) PRIMARY KEY (id)
) ; ) ;

1
sql/dolphinscheduler_mysql.sql

@ -366,6 +366,7 @@ CREATE TABLE `t_ds_process_definition` (
`timeout` int(11) DEFAULT '0' COMMENT 'time out', `timeout` int(11) DEFAULT '0' COMMENT 'time out',
`tenant_id` int(11) NOT NULL DEFAULT '-1' COMMENT 'tenant id', `tenant_id` int(11) NOT NULL DEFAULT '-1' COMMENT 'tenant id',
`update_time` datetime DEFAULT NULL COMMENT 'update time', `update_time` datetime DEFAULT NULL COMMENT 'update time',
`modify_by` varchar(36) DEFAULT '' COMMENT 'modify user',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `process_definition_index` (`project_id`,`id`) USING BTREE KEY `process_definition_index` (`project_id`,`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

37
sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql

@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
-- uc_dolphin_T_t_ds_process_definition_A_modify_by
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by;
delimiter d//
CREATE PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by()
BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_process_definition'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME ='modify_by')
THEN
ALTER TABLE t_ds_process_definition ADD `modify_by` varchar(36) DEFAULT '' COMMENT 'modify user';
END IF;
END;
d//
delimiter ;
CALL uc_dolphin_T_t_ds_process_definition_A_modify_by;
DROP PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by;

12
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ArrayUtils.java → sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_dml.sql

@ -13,14 +13,4 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.common.utils;
public class ArrayUtils {
public static boolean isEmpty(final int[] array) {
return array == null || array.length == 0;
}
}

34
sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql

@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-- uc_dolphin_T_t_ds_process_definition_A_modify_by
delimiter d//
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_process_definition_A_modify_by() RETURNS void AS $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_NAME='t_ds_process_definition'
AND COLUMN_NAME ='modify_by')
THEN
ALTER TABLE t_ds_process_definition ADD COLUMN modify_by varchar(36) DEFAULT '';
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
SELECT uc_dolphin_T_t_ds_process_definition_A_modify_by();
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by();

16
sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_dml.sql

@ -0,0 +1,16 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Loading…
Cancel
Save