Browse Source

Merge pull request #3 from apache/dev

update code
pull/2/head
BoYiZhang 5 years ago committed by GitHub
parent
commit
6f80e33474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 5
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java
  3. 10
      dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/ExcelUtilsTest.java
  4. 5
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
  5. 9
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  6. 2
      dolphinscheduler-dao/src/main/resources/application.properties
  7. 81
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java
  8. 3
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java
  9. 99
      dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTaskTest.java
  10. 24
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
  11. 36
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  12. 34
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
  13. 18
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  14. 21
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  15. 36
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
  16. 2
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue
  17. 11
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
  18. 2
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
  19. 1
      pom.xml
  20. 4
      sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_dml.sql

1
.gitignore vendored

@ -145,6 +145,5 @@ dolphinscheduler-ui/dist/js/home/index.78a5d12.js.map
dolphinscheduler-ui/dist/js/login/index.291b8e3.js dolphinscheduler-ui/dist/js/login/index.291b8e3.js
dolphinscheduler-ui/dist/js/login/index.291b8e3.js.map dolphinscheduler-ui/dist/js/login/index.291b8e3.js.map
dolphinscheduler-ui/dist/lib/external/ dolphinscheduler-ui/dist/lib/external/
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/index.vue
/dolphinscheduler-dao/src/main/resources/dao/data_source.properties /dolphinscheduler-dao/src/main/resources/dao/data_source.properties

5
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java

@ -26,6 +26,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -102,7 +103,11 @@ public class ExcelUtils {
for (int i = 0; i < headerList.size(); i++) { for (int i = 0; i < headerList.size(); i++) {
sheet.setColumnWidth(i, headerList.get(i).length() * 800); sheet.setColumnWidth(i, headerList.get(i).length() * 800);
}
File file = new File(xlsFilePath);
if (!file.exists()) {
file.mkdirs();
} }
//setting file output //setting file output

10
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/ExcelUtilsTest.java

@ -89,4 +89,14 @@ public class ExcelUtilsTest {
ExcelUtils.genExcelFile(incorrectContent1, title, xlsFilePath); ExcelUtils.genExcelFile(incorrectContent1, title, xlsFilePath);
} }
/**
* Test GenExcelFile (check directory)
*/
@Test
public void testGenExcelFileByCheckDir() {
ExcelUtils.genExcelFile("[{\"a\": \"a\"},{\"a\": \"a\"}]", "t", "/tmp/xls");
File file = new File("/tmp/xls" + Constants.SINGLE_SLASH + "t" + Constants.EXCEL_SUFFIX_XLS);
file.delete();
}
} }

5
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java

@ -453,7 +453,7 @@ public class ExecutorService extends BaseService{
TaskDependType nodeDep, FailureStrategy failureStrategy, TaskDependType nodeDep, FailureStrategy failureStrategy,
String startNodeList, String schedule, WarningType warningType, String startNodeList, String schedule, WarningType warningType,
int excutorId, int warningGroupId, int excutorId, int warningGroupId,
RunMode runMode,Priority processInstancePriority, int workerGroupId) throws ParseException { RunMode runMode,Priority processInstancePriority, int workerGroupId){
/** /**
* instantiate command schedule instance * instantiate command schedule instance
@ -496,6 +496,7 @@ public class ExecutorService extends BaseService{
} }
} }
// determine whether to complement
if(commandType == CommandType.COMPLEMENT_DATA){ if(commandType == CommandType.COMPLEMENT_DATA){
runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode;
if(null != start && null != end && start.before(end)){ if(null != start && null != end && start.before(end)){
@ -540,7 +541,7 @@ public class ExecutorService extends BaseService{
processDefineId, schedule); processDefineId, schedule);
} }
}else{ }else{
command.setCommandParam(JSONUtils.toJson(cmdParam));
return processService.createCommand(command); return processService.createCommand(command);
} }

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

@ -307,20 +307,19 @@ public class ProcessDefinitionService extends BaseDAGService {
if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) { if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) {
return checkProcessJson; return checkProcessJson;
} }
ProcessDefinition processDefinition = processService.findProcessDefineById(id); ProcessDefinition processDefine = processService.findProcessDefineById(id);
if (processDefinition == null) { if (processDefine == null) {
// check process definition exists // check process definition exists
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id);
return result; return result;
} else if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { } else if (processDefine.getReleaseState() == ReleaseState.ONLINE) {
// online can not permit edit // online can not permit edit
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName());
return result; return result;
} else { } else {
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
} }
ProcessDefinition processDefine = processService.findProcessDefineById(id);
Date now = new Date(); Date now = new Date();
processDefine.setId(id); processDefine.setId(id);

2
dolphinscheduler-dao/src/main/resources/application.properties

@ -22,7 +22,7 @@ spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler
# mysql # mysql
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://192.168.xx.xx:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 #spring.datasource.url=jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
# h2 # h2
#spring.datasource.driver-class-name=org.h2.Driver #spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:file:../sql/h2;AUTO_SERVER=TRUE #spring.datasource.url=jdbc:h2:file:../sql/h2;AUTO_SERVER=TRUE

81
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentExecute.java

@ -22,6 +22,7 @@ import org.apache.dolphinscheduler.common.enums.DependentRelation;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.model.DateInterval; import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.DependentItem; import org.apache.dolphinscheduler.common.model.DependentItem;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.DependentUtils; import org.apache.dolphinscheduler.common.utils.DependentUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance;
@ -82,7 +83,7 @@ public class DependentExecute {
* @param currentTime current time * @param currentTime current time
* @return DependResult * @return DependResult
*/ */
public DependResult getDependentResultForItem(DependentItem dependentItem, Date currentTime){ private DependResult getDependentResultForItem(DependentItem dependentItem, Date currentTime){
List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(currentTime, dependentItem.getDateValue()); List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(currentTime, dependentItem.getDateValue());
return calculateResultForTasks(dependentItem, dateIntervals ); return calculateResultForTasks(dependentItem, dateIntervals );
} }
@ -95,6 +96,7 @@ public class DependentExecute {
*/ */
private DependResult calculateResultForTasks(DependentItem dependentItem, private DependResult calculateResultForTasks(DependentItem dependentItem,
List<DateInterval> dateIntervals) { List<DateInterval> dateIntervals) {
DependResult result = DependResult.FAILED; DependResult result = DependResult.FAILED;
for(DateInterval dateInterval : dateIntervals){ for(DateInterval dateInterval : dateIntervals){
ProcessInstance processInstance = findLastProcessInterval(dependentItem.getDefinitionId(), ProcessInstance processInstance = findLastProcessInterval(dependentItem.getDefinitionId(),
@ -104,30 +106,69 @@ public class DependentExecute {
dependentItem.getDefinitionId(), dateInterval.getStartTime(), dateInterval.getEndTime() ); dependentItem.getDefinitionId(), dateInterval.getStartTime(), dateInterval.getEndTime() );
return DependResult.FAILED; return DependResult.FAILED;
} }
// need to check workflow for updates, so get all task and check the task state
if(dependentItem.getDepTasks().equals(Constants.DEPENDENT_ALL)){ if(dependentItem.getDepTasks().equals(Constants.DEPENDENT_ALL)){
result = getDependResultByState(processInstance.getState()); List<TaskNode> taskNodes =
processService.getTaskNodeListByDefinitionId(dependentItem.getDefinitionId());
if(taskNodes != null && taskNodes.size() > 0){
List<DependResult> results = new ArrayList<>();
DependResult tmpResult = DependResult.FAILED;
for(TaskNode taskNode:taskNodes){
tmpResult = getDependTaskResult(taskNode.getName(),processInstance);
if(DependResult.FAILED == tmpResult){
break;
}else{
results.add(getDependTaskResult(taskNode.getName(),processInstance));
}
}
if(DependResult.FAILED == tmpResult){
result = DependResult.FAILED;
}else if(results.contains(DependResult.WAITING)){
result = DependResult.WAITING;
}else{
result = DependResult.SUCCESS;
}
}else{
result = DependResult.FAILED;
}
}else{ }else{
result = getDependTaskResult(dependentItem.getDepTasks(),processInstance);
}
if(result != DependResult.SUCCESS){
break;
}
}
return result;
}
/**
* get depend task result
* @param taskName
* @param processInstance
* @return
*/
private DependResult getDependTaskResult(String taskName, ProcessInstance processInstance) {
DependResult result = DependResult.FAILED;
TaskInstance taskInstance = null; TaskInstance taskInstance = null;
List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processInstance.getId()); List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processInstance.getId());
for(TaskInstance task : taskInstanceList){ for(TaskInstance task : taskInstanceList){
if(task.getName().equals(dependentItem.getDepTasks())){ if(task.getName().equals(taskName)){
taskInstance = task; taskInstance = task;
break; break;
} }
} }
if(taskInstance == null){ if(taskInstance == null){
// cannot find task in the process instance // cannot find task in the process instance
// maybe because process instance is running or failed. // maybe because process instance is running or failed.
result = getDependResultByState(processInstance.getState()); result = getDependResultByProcessStateWhenTaskNull(processInstance.getState());
}else{ }else{
result = getDependResultByState(taskInstance.getState()); result = getDependResultByState(taskInstance.getState());
} }
}
if(result != DependResult.SUCCESS){
break;
}
}
return result; return result;
} }
@ -172,7 +213,9 @@ public class DependentExecute {
*/ */
private DependResult getDependResultByState(ExecutionStatus state) { private DependResult getDependResultByState(ExecutionStatus state) {
if(state.typeIsRunning() || state == ExecutionStatus.SUBMITTED_SUCCESS || state == ExecutionStatus.WAITTING_THREAD){ if(state.typeIsRunning()
|| state == ExecutionStatus.SUBMITTED_SUCCESS
|| state == ExecutionStatus.WAITTING_THREAD){
return DependResult.WAITING; return DependResult.WAITING;
}else if(state.typeIsSuccess()){ }else if(state.typeIsSuccess()){
return DependResult.SUCCESS; return DependResult.SUCCESS;
@ -181,6 +224,22 @@ public class DependentExecute {
} }
} }
/**
* get dependent result by task instance state when task instance is null
* @param state state
* @return DependResult
*/
private DependResult getDependResultByProcessStateWhenTaskNull(ExecutionStatus state) {
if(state.typeIsRunning()
|| state == ExecutionStatus.SUBMITTED_SUCCESS
|| state == ExecutionStatus.WAITTING_THREAD){
return DependResult.WAITING;
}else{
return DependResult.FAILED;
}
}
/** /**
* judge depend item finished * judge depend item finished
* @param currentTime current time * @param currentTime current time
@ -222,7 +281,7 @@ public class DependentExecute {
* @param currentTime current time * @param currentTime current time
* @return DependResult * @return DependResult
*/ */
public DependResult getDependResultForItem(DependentItem item, Date currentTime){ private DependResult getDependResultForItem(DependentItem item, Date currentTime){
String key = item.getKey(); String key = item.getKey();
if(dependResultMap.containsKey(key)){ if(dependResultMap.containsKey(key)){
return dependResultMap.get(key); return dependResultMap.get(key);

3
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTask.java

@ -82,11 +82,12 @@ public class DependentTask extends AbstractTask {
this.dependentParameters = JSONUtils.parseObject(this.taskProps.getDependence(), this.dependentParameters = JSONUtils.parseObject(this.taskProps.getDependence(),
DependentParameters.class); DependentParameters.class);
if(dependentParameters != null){
for(DependentTaskModel taskModel : dependentParameters.getDependTaskList()){ for(DependentTaskModel taskModel : dependentParameters.getDependTaskList()){
this.dependentTaskList.add(new DependentExecute( this.dependentTaskList.add(new DependentExecute(
taskModel.getDependItemList(), taskModel.getRelation())); taskModel.getDependItemList(), taskModel.getRelation()));
} }
}
this.processService = SpringApplicationContext.getBean(ProcessService.class); this.processService = SpringApplicationContext.getBean(ProcessService.class);

99
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/dependent/DependentTaskTest.java

@ -17,47 +17,106 @@
package org.apache.dolphinscheduler.server.worker.task.dependent; package org.apache.dolphinscheduler.server.worker.task.dependent;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.model.DateInterval;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.utils.dependent.DependentDateUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.worker.task.TaskProps; import org.apache.dolphinscheduler.server.worker.task.TaskProps;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RunWith(MockitoJUnitRunner.Silent.class)
public class DependentTaskTest { public class DependentTaskTest {
private static final Logger logger = LoggerFactory.getLogger(DependentTaskTest.class); private static final Logger logger = LoggerFactory.getLogger(DependentTaskTest.class);
private ProcessService processService;
private ApplicationContext applicationContext;
@Test
public void testDependInit() throws Exception{
TaskProps taskProps = new TaskProps(); @Before
public void before() throws Exception{
processService = Mockito.mock(ProcessService.class);
Mockito.when(processService
.findLastRunningProcess(4,DependentDateUtils.getTodayInterval(new Date()).get(0)))
.thenReturn(findLastProcessInterval());
Mockito.when(processService
.getTaskNodeListByDefinitionId(4))
.thenReturn(getTaskNodes());
Mockito.when(processService
.findValidTaskListByProcessId(11))
.thenReturn(getTaskInstances());
String dependString = "{\n" + Mockito.when(processService
"\"dependTaskList\":[\n" + .findTaskInstanceById(252612))
" {\n" + .thenReturn(getTaskInstance());
" \"dependItemList\":[\n" + applicationContext = Mockito.mock(ApplicationContext.class);
" {\n" + SpringApplicationContext springApplicationContext = new SpringApplicationContext();
" \"definitionId\": 101,\n" + springApplicationContext.setApplicationContext(applicationContext);
" \"depTasks\": \"ALL\",\n" + Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService);
" \"cycle\": \"day\",\n" + }
" \"dateValue\": \"last1Day\"\n" +
" }\n" +
" ],\n" +
" \"relation\": \"AND\"\n" +
" }\n" +
" ],\n" +
"\"relation\":\"OR\"\n" +
"}";
@Test
public void test() throws Exception{
TaskProps taskProps = new TaskProps();
String dependString = "{\"dependTaskList\":[{\"dependItemList\":[{\"dateValue\":\"today\",\"depTasks\":\"ALL\",\"projectId\":1,\"definitionList\":[{\"label\":\"C\",\"value\":4},{\"label\":\"B\",\"value\":3},{\"label\":\"A\",\"value\":2}],\"cycle\":\"day\",\"definitionId\":4}],\"relation\":\"AND\"}],\"relation\":\"AND\"}";
taskProps.setTaskInstId(252612); taskProps.setTaskInstId(252612);
taskProps.setDependence(dependString); taskProps.setDependence(dependString);
taskProps.setTaskStartTime(new Date());
DependentTask dependentTask = new DependentTask(taskProps, logger); DependentTask dependentTask = new DependentTask(taskProps, logger);
dependentTask.init(); dependentTask.init();
dependentTask.handle(); dependentTask.handle();
Assert.assertEquals(dependentTask.getExitStatusCode(), Constants.EXIT_CODE_FAILURE ); Assert.assertEquals(dependentTask.getExitStatusCode(), Constants.EXIT_CODE_SUCCESS );
} }
private ProcessInstance findLastProcessInterval(){
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(11);
processInstance.setState(ExecutionStatus.SUCCESS);
return processInstance;
}
private List<TaskNode> getTaskNodes(){
List<TaskNode> list = new ArrayList<>();
TaskNode taskNode = new TaskNode();
taskNode.setName("C");
taskNode.setType("SQL");
list.add(taskNode);
return list;
}
private List<TaskInstance> getTaskInstances(){
List<TaskInstance> list = new ArrayList<>();
TaskInstance taskInstance = new TaskInstance();
taskInstance.setName("C");
taskInstance.setState(ExecutionStatus.SUCCESS);
taskInstance.setDependency("1231");
list.add(taskInstance);
return list;
}
private TaskInstance getTaskInstance(){
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(252612);
taskInstance.setName("C");
taskInstance.setState(ExecutionStatus.SUCCESS);
return taskInstance;
}
} }

24
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -236,6 +236,30 @@ public class ProcessService {
return processInstanceMapper.queryDetailById(processId); return processInstanceMapper.queryDetailById(processId);
} }
/**
* get task node list by definitionId
* @param defineId
* @return
*/
public List<TaskNode> getTaskNodeListByDefinitionId(Integer defineId){
ProcessDefinition processDefinition = processDefineMapper.selectById(defineId);
if (processDefinition == null) {
logger.info("process define not exists");
return null;
}
String processDefinitionJson = processDefinition.getProcessDefinitionJson();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
//process data check
if (null == processData) {
logger.error("process data is null");
return null;
}
return processData.getTasks();
}
/** /**
* find process instance by id * find process instance by id
* @param processId processId * @param processId processId

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

@ -218,6 +218,19 @@
}, },
mixins: [disabledState], mixins: [disabledState],
methods: { methods: {
/**
* getResourceId
*/
marjarId(name) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+name
}).then(res => {
this.mainJar = res.id
}).catch(e => {
this.$message.error(e.msg || '')
})
},
/** /**
* return localParams * return localParams
*/ */
@ -366,7 +379,13 @@
// 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 && o.params.mainJar.id ? o.params.mainJar.id : '' if(o.params.mainJar.res) {
this.marjarId(o.params.mainJar.res)
} else if(o.params.mainJar.res=='') {
this.mainJar = ''
} else {
this.mainJar = o.params.mainJar.id || ''
}
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'
@ -380,8 +399,19 @@
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = _.map(resourceList, v => { _.map(resourceList, v => {
return v.id if(v.res) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+v.res
}).then(res => {
this.resourceList.push(res.id)
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.resourceList.push(v.id)
}
}) })
this.cacheResourceList = resourceList this.cacheResourceList = resourceList
} }

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

@ -142,6 +142,19 @@
}, },
mixins: [disabledState], mixins: [disabledState],
methods: { methods: {
/**
* getResourceId
*/
marjarId(name) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+name
}).then(res => {
this.mainJar = res.id
}).catch(e => {
this.$message.error(e.msg || '')
})
},
/** /**
* return localParams * return localParams
*/ */
@ -245,7 +258,13 @@
// 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 || ''
if(o.params.mainJar.res) {
this.marjarId(o.params.mainJar.res)
} else if(o.params.mainJar.res=='') {
this.mainJar = ''
} else {
this.mainJar = o.params.mainJar.id || '' this.mainJar = o.params.mainJar.id || ''
}
this.mainArgs = o.params.mainArgs || '' this.mainArgs = o.params.mainArgs || ''
this.others = o.params.others this.others = o.params.others
this.programType = o.params.programType || 'JAVA' this.programType = o.params.programType || 'JAVA'
@ -253,8 +272,19 @@
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = _.map(resourceList, v => { _.map(resourceList, v => {
return v.id if(v.res) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+v.res
}).then(res => {
this.resourceList.push(res.id)
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.resourceList.push(v.id)
}
}) })
this.cacheResourceList = resourceList this.cacheResourceList = resourceList
} }

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

@ -161,8 +161,7 @@
resourceList: _.map(this.resourceList, v => { resourceList: _.map(this.resourceList, v => {
return {id: v} return {id: v}
}), }),
localParams: this.localParams, localParams: this.localParams
rawScript: editor ? editor.getValue() : ''
} }
} }
}, },
@ -176,8 +175,19 @@
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = _.map(resourceList, v => { _.map(resourceList, v => {
return v.id if(v.res) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+v.res
}).then(res => {
this.resourceList.push(res.id)
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.resourceList.push(v.id)
}
}) })
this.cacheResourceList = resourceList this.cacheResourceList = resourceList
} }

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

@ -95,7 +95,7 @@
return { return {
label: node.name label: node.name
} }
}, }
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -221,8 +221,7 @@
resourceList: _.map(this.resourceList, v => { resourceList: _.map(this.resourceList, v => {
return {id: v} return {id: v}
}), }),
localParams: this.localParams, localParams: this.localParams
rawScript: editor ? editor.getValue() : ''
} }
} }
}, },
@ -238,12 +237,22 @@
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = _.map(resourceList, v => { _.map(resourceList, v => {
return v.id if(v.res) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+v.res
}).then(res => {
this.resourceList.push(res.id)
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.resourceList.push(v.id)
}
}) })
this.cacheResourceList = resourceList this.cacheResourceList = resourceList
} }
// backfill localParams // backfill localParams
let localParams = o.params.localParams || [] let localParams = o.params.localParams || []
if (localParams.length) { if (localParams.length) {

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

@ -261,6 +261,19 @@
}, },
mixins: [disabledState], mixins: [disabledState],
methods: { methods: {
/**
* getResourceId
*/
marjarId(name) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+name
}).then(res => {
this.mainJar = res.id
}).catch(e => {
this.$message.error(e.msg || '')
})
},
/** /**
* return localParams * return localParams
*/ */
@ -414,7 +427,13 @@
// 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 && o.params.mainJar.id ? o.params.mainJar.id : '' if(o.params.mainJar.res) {
this.marjarId(o.params.mainJar.res)
} else if(o.params.mainJar.res=='') {
this.mainJar = ''
} else {
this.mainJar = o.params.mainJar.id || ''
}
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'
@ -429,8 +448,19 @@
// backfill resourceList // backfill resourceList
let resourceList = o.params.resourceList || [] let resourceList = o.params.resourceList || []
if (resourceList.length) { if (resourceList.length) {
this.resourceList = _.map(resourceList, v => { _.map(resourceList, v => {
return v.id if(v.res) {
this.store.dispatch('dag/getResourceId',{
type: 'FILE',
fullName: '/'+v.res
}).then(res => {
this.resourceList.push(res.id)
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.resourceList.push(v.id)
}
}) })
this.cacheResourceList = resourceList this.cacheResourceList = resourceList
} }

2
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue

@ -22,7 +22,7 @@
<th scope="col" width="50"> <th scope="col" width="50">
<x-checkbox @on-change="_topCheckBoxClick" v-model="checkAll"></x-checkbox> <x-checkbox @on-change="_topCheckBoxClick" v-model="checkAll"></x-checkbox>
</th> </th>
<th scope="col"> <th scope="col" width="30">
<span>{{$t('#')}}</span> <span>{{$t('#')}}</span>
</th> </th>
<th scope="col" width="70"> <th scope="col" width="70">

11
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@ -715,5 +715,14 @@ export default {
reject(e) reject(e)
}) })
}) })
} },
getResourceId ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`resources/queryResource`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
})
})
},
} }

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

@ -115,7 +115,7 @@ export default {
'SQL Type': 'sql类型', 'SQL Type': 'sql类型',
'Title': '主题', 'Title': '主题',
'Please enter the title of email': '请输入邮件主题', 'Please enter the title of email': '请输入邮件主题',
'Table': '', 'Table': '',
'Attachment': '附件', 'Attachment': '附件',
'SQL Parameter': 'sql参数', 'SQL Parameter': 'sql参数',
'SQL Statement': 'sql语句', 'SQL Statement': 'sql语句',

1
pom.xml

@ -740,6 +740,7 @@
<include>**/server/worker/task/datax/DataxTaskTest.java</include> <include>**/server/worker/task/datax/DataxTaskTest.java</include>
<include>**/server/worker/task/shell/ShellTaskTest.java</include> <include>**/server/worker/task/shell/ShellTaskTest.java</include>
<include>**/server/worker/task/sqoop/SqoopTaskTest.java</include> <include>**/server/worker/task/sqoop/SqoopTaskTest.java</include>
<include>**/server/worker/task/dependent/DependentTaskTest.java</include>
<include>**/server/utils/DataxUtilsTest.java</include> <include>**/server/utils/DataxUtilsTest.java</include>
<include>**/service/zk/DefaultEnsembleProviderTest.java</include> <include>**/service/zk/DefaultEnsembleProviderTest.java</include>
<include>**/dao/datasource/BaseDataSourceTest.java</include> <include>**/dao/datasource/BaseDataSourceTest.java</include>

4
sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_dml.sql

@ -14,3 +14,7 @@
* 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.
*/ */
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
SET FOREIGN_KEY_CHECKS=0;
UPDATE t_ds_resources SET pid=-1,is_directory=false WHERE pid IS NULL;
UPDATE t_ds_resources SET full_name = concat('/',alias) WHERE pid=-1 and full_name IS NULL;
Loading…
Cancel
Save