status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | processMap.setParentProcessInstanceId(parentInstance.getId());
processMap.setParentTaskInstanceId(parentTask.getId());
createWorkProcessInstanceMap(processMap);
return processMap;
}
/**
* find previous task work process map.
*
* @param parentProcessInstance parentProcessInstance
* @param parentTask parentTask
* @return process instance map
*/
private ProcessInstanceMap findPreviousTaskProcessMap(ProcessInstance parentProcessInstance,
TaskInstance parentTask) {
Integer preTaskId = 0;
List<TaskInstance> preTaskList = this.findPreviousTaskListByWorkProcessId(parentProcessInstance.getId());
for (TaskInstance task : preTaskList) {
if (task.getName().equals(parentTask.getName())) {
preTaskId = task.getId();
ProcessInstanceMap map = findWorkProcessMapByParent(parentProcessInstance.getId(), preTaskId);
if (map != null) {
return map;
}
}
}
logger.info("sub process instance is not found,parent task:{},parent instance:{}",
parentTask.getId(), parentProcessInstance.getId());
return null;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * create sub work process command
*
* @param parentProcessInstance parentProcessInstance
* @param task task
*/
@Override
public void createSubWorkProcess(ProcessInstance parentProcessInstance, TaskInstance task) {
if (!task.isSubProcess()) {
return;
}
ProcessInstanceMap instanceMap = findWorkProcessMapByParent(parentProcessInstance.getId(), task.getId());
if (null != instanceMap && CommandType.RECOVER_TOLERANCE_FAULT_PROCESS == parentProcessInstance.getCommandType()) {
return;
}
instanceMap = setProcessInstanceMap(parentProcessInstance, task);
ProcessInstance childInstance = null;
if (instanceMap.getProcessInstanceId() != 0) {
childInstance = findProcessInstanceById(instanceMap.getProcessInstanceId());
}
Command subProcessCommand = createSubProcessCommand(parentProcessInstance, childInstance, instanceMap, task);
updateSubProcessDefinitionByParent(parentProcessInstance, subProcessCommand.getProcessDefinitionCode());
initSubInstanceState(childInstance);
createCommand(subProcessCommand);
logger.info("sub process command created: {} ", subProcessCommand);
}
/**
* complement data needs transform parent parameter to child.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | protected String getSubWorkFlowParam(ProcessInstanceMap instanceMap, ProcessInstance parentProcessInstance, Map<String, String> fatherParams) {
String processMapStr = JSONUtils.toJsonString(instanceMap);
Map<String, String> cmdParam = JSONUtils.toMap(processMapStr);
if (parentProcessInstance.isComplementData()) {
Map<String, String> parentParam = JSONUtils.toMap(parentProcessInstance.getCommandParam());
String endTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE);
String startTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endTime);
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startTime);
processMapStr = JSONUtils.toJsonString(cmdParam);
}
if (fatherParams.size() != 0) {
cmdParam.put(CMD_PARAM_FATHER_PARAMS, JSONUtils.toJsonString(fatherParams));
processMapStr = JSONUtils.toJsonString(cmdParam);
}
return processMapStr;
}
@Override
public Map<String, String> getGlobalParamMap(String globalParams) {
List<Property> propList;
Map<String, String> globalParamMap = new HashMap<>();
if (!Strings.isNullOrEmpty(globalParams)) {
propList = JSONUtils.toList(globalParams, Property.class);
globalParamMap = propList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
}
return globalParamMap;
}
/**
* create sub work process command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
public Command createSubProcessCommand(ProcessInstance parentProcessInstance,
ProcessInstance childInstance,
ProcessInstanceMap instanceMap,
TaskInstance task) {
CommandType commandType = getSubCommandType(parentProcessInstance, childInstance);
Map<String, Object> subProcessParam = JSONUtils.toMap(task.getTaskParams(), String.class, Object.class);
long childDefineCode = 0L;
if (subProcessParam.containsKey(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)) {
childDefineCode = Long.parseLong(String.valueOf(subProcessParam.get(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)));
}
ProcessDefinition subProcessDefinition = processDefineMapper.queryByCode(childDefineCode);
Object localParams = subProcessParam.get(Constants.LOCAL_PARAMS);
List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class);
Map<String, String> globalMap = this.getGlobalParamMap(task.getVarPool());
Map<String, String> fatherParams = new HashMap<>();
if (CollectionUtils.isNotEmpty(allParam)) {
for (Property info : allParam) {
if (Direct.OUT == info.getDirect()) {
continue;
}
fatherParams.put(info.getProp(), globalMap.get(info.getProp()));
}
}
String processParam = getSubWorkFlowParam(instanceMap, parentProcessInstance, fatherParams);
int subProcessInstanceId = childInstance == null ? 0 : childInstance.getId();
return new Command(
commandType,
TaskDependType.TASK_POST, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | parentProcessInstance.getFailureStrategy(),
parentProcessInstance.getExecutorId(),
subProcessDefinition.getCode(),
processParam,
parentProcessInstance.getWarningType(),
parentProcessInstance.getWarningGroupId(),
parentProcessInstance.getScheduleTime(),
task.getWorkerGroup(),
task.getEnvironmentCode(),
parentProcessInstance.getProcessInstancePriority(),
parentProcessInstance.getDryRun(),
subProcessInstanceId,
subProcessDefinition.getVersion()
);
}
/**
* initialize sub work flow state
* child instance state would be initialized when 'recovery from pause/stop/failure'
*/
private void initSubInstanceState(ProcessInstance childInstance) {
if (childInstance != null) {
childInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
updateProcessInstance(childInstance);
}
}
/**
* get sub work flow command type
* child instance exist: child command = fatherCommand
* child instance not exists: child command = fatherCommand[0]
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | private CommandType getSubCommandType(ProcessInstance parentProcessInstance, ProcessInstance childInstance) {
CommandType commandType = parentProcessInstance.getCommandType();
if (childInstance == null) {
String fatherHistoryCommand = parentProcessInstance.getHistoryCmd();
commandType = CommandType.valueOf(fatherHistoryCommand.split(Constants.COMMA)[0]);
}
return commandType;
}
/**
* update sub process definition
*
* @param parentProcessInstance parentProcessInstance
* @param childDefinitionCode childDefinitionId
*/
private void updateSubProcessDefinitionByParent(ProcessInstance parentProcessInstance, long childDefinitionCode) {
ProcessDefinition fatherDefinition = this.findProcessDefinition(parentProcessInstance.getProcessDefinitionCode(),
parentProcessInstance.getProcessDefinitionVersion());
ProcessDefinition childDefinition = this.findProcessDefinitionByCode(childDefinitionCode);
if (childDefinition != null && fatherDefinition != null) {
childDefinition.setWarningGroupId(fatherDefinition.getWarningGroupId());
processDefineMapper.updateById(childDefinition);
}
}
/**
* submit task to mysql
*
* @param taskInstance taskInstance
* @param processInstance processInstance
* @return task instance
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public TaskInstance submitTaskInstanceToDB(TaskInstance taskInstance, ProcessInstance processInstance) {
ExecutionStatus processInstanceState = processInstance.getState();
if (processInstanceState.typeIsFinished() || processInstanceState == ExecutionStatus.READY_STOP) {
logger.warn("processInstance {} was {}, skip submit task", processInstance.getProcessDefinitionCode(), processInstanceState);
return null;
}
if (processInstanceState == ExecutionStatus.READY_PAUSE) {
taskInstance.setState(ExecutionStatus.PAUSE);
}
taskInstance.setExecutorId(processInstance.getExecutorId());
taskInstance.setState(getSubmitTaskState(taskInstance, processInstance));
if (taskInstance.getSubmitTime() == null) {
taskInstance.setSubmitTime(new Date());
}
if (taskInstance.getFirstSubmitTime() == null) {
taskInstance.setFirstSubmitTime(taskInstance.getSubmitTime());
}
boolean saveResult = saveTaskInstance(taskInstance);
if (!saveResult) {
return null;
}
return taskInstance;
}
/**
* get submit task instance state by the work process state
* cannot modify the task state when running/kill/submit success, or this
* task instance is already exists in task queue .
* return pause if work process state is ready pause
* return stop if work process state is ready stop |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * if all of above are not satisfied, return submit success
*
* @param taskInstance taskInstance
* @param processInstance processInstance
* @return process instance state
*/
@Override
public ExecutionStatus getSubmitTaskState(TaskInstance taskInstance, ProcessInstance processInstance) {
ExecutionStatus state = taskInstance.getState();
if (
state == ExecutionStatus.RUNNING_EXECUTION
|| state == ExecutionStatus.DELAY_EXECUTION
|| state == ExecutionStatus.KILL
|| state == ExecutionStatus.DISPATCH
) {
return state;
}
if (processInstance.getState() == ExecutionStatus.READY_PAUSE) {
state = ExecutionStatus.PAUSE;
} else if (processInstance.getState() == ExecutionStatus.READY_STOP
|| !checkProcessStrategy(taskInstance, processInstance)) {
state = ExecutionStatus.KILL;
} else {
state = ExecutionStatus.SUBMITTED_SUCCESS;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return state;
}
/**
* check process instance strategy
*
* @param taskInstance taskInstance
* @return check strategy result
*/
private boolean checkProcessStrategy(TaskInstance taskInstance, ProcessInstance processInstance) {
FailureStrategy failureStrategy = processInstance.getFailureStrategy();
if (failureStrategy == FailureStrategy.CONTINUE) {
return true;
}
List<TaskInstance> taskInstances = this.findValidTaskListByProcessId(taskInstance.getProcessInstanceId());
for (TaskInstance task : taskInstances) {
if (task.getState() == ExecutionStatus.FAILURE
&& task.getRetryTimes() >= task.getMaxRetryTimes()) {
return false;
}
}
return true;
}
/**
* insert or update work process instance to data base
*
* @param processInstance processInstance
*/
@Override
public void saveProcessInstance(ProcessInstance processInstance) {
if (processInstance == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | logger.error("save error, process instance is null!");
return;
}
if (processInstance.getId() != 0) {
processInstanceMapper.updateById(processInstance);
} else {
processInstanceMapper.insert(processInstance);
}
}
/**
* insert or update command
*
* @param command command
* @return save command result
*/
@Override
public int saveCommand(Command command) {
if (command.getId() != 0) {
return commandMapper.updateById(command);
} else {
return commandMapper.insert(command);
}
}
/**
* insert or update task instance
*
* @param taskInstance taskInstance
* @return save task instance result
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | public boolean saveTaskInstance(TaskInstance taskInstance) {
if (taskInstance.getId() != 0) {
return updateTaskInstance(taskInstance);
} else {
return createTaskInstance(taskInstance);
}
}
/**
* insert task instance
*
* @param taskInstance taskInstance
* @return create task instance result
*/
@Override
public boolean createTaskInstance(TaskInstance taskInstance) {
int count = taskInstanceMapper.insert(taskInstance);
return count > 0;
}
/**
* update task instance
*
* @param taskInstance taskInstance
* @return update task instance result
*/
@Override
public boolean updateTaskInstance(TaskInstance taskInstance) {
int count = taskInstanceMapper.updateById(taskInstance);
return count > 0;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * find task instance by id
*
* @param taskId task id
* @return task instance
*/
@Override
public TaskInstance findTaskInstanceById(Integer taskId) {
return taskInstanceMapper.selectById(taskId);
}
/**
* find task instance list by id list
*
* @param idList task id list
* @return task instance list
*/
@Override
public List<TaskInstance> findTaskInstanceByIdList(List<Integer> idList) {
if (CollectionUtils.isEmpty(idList)) {
return new ArrayList<>();
}
return taskInstanceMapper.selectBatchIds(idList);
}
/**
* package task instance
*/
@Override
public void packageTaskInstance(TaskInstance taskInstance, ProcessInstance processInstance) {
taskInstance.setProcessInstance(processInstance);
taskInstance.setProcessDefine(processInstance.getProcessDefinition());
taskInstance.setProcessInstancePriority(processInstance.getProcessInstancePriority()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | TaskDefinition taskDefinition = this.findTaskDefinition(
taskInstance.getTaskCode(),
taskInstance.getTaskDefinitionVersion());
this.updateTaskDefinitionResources(taskDefinition);
taskInstance.setTaskDefine(taskDefinition);
}
/**
* Update {@link ResourceInfo} information in {@link TaskDefinition}
*
* @param taskDefinition the given {@link TaskDefinition}
*/
@Override
public void updateTaskDefinitionResources(TaskDefinition taskDefinition) {
Map<String, Object> taskParameters = JSONUtils.parseObject(
taskDefinition.getTaskParams(),
new TypeReference<Map<String, Object>>() {
});
if (taskParameters != null) {
if (taskParameters.containsKey("mainJar")) {
Object mainJarObj = taskParameters.get("mainJar");
ResourceInfo mainJar = JSONUtils.parseObject(
JSONUtils.toJsonString(mainJarObj),
ResourceInfo.class);
ResourceInfo resourceInfo = updateResourceInfo(mainJar);
if (resourceInfo != null) {
taskParameters.put("mainJar", resourceInfo);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (taskParameters.containsKey("resourceList")) {
String resourceListStr = JSONUtils.toJsonString(taskParameters.get("resourceList"));
List<ResourceInfo> resourceInfos = JSONUtils.toList(resourceListStr, ResourceInfo.class);
List<ResourceInfo> updatedResourceInfos = resourceInfos
.stream()
.map(this::updateResourceInfo)
.filter(Objects::nonNull)
.collect(Collectors.toList());
taskParameters.put("resourceList", updatedResourceInfos);
}
taskDefinition.setTaskParams(JSONUtils.toJsonString(taskParameters));
}
}
/**
* update {@link ResourceInfo} by given original ResourceInfo
*
* @param res origin resource info
* @return {@link ResourceInfo}
*/
private ResourceInfo updateResourceInfo(ResourceInfo res) {
ResourceInfo resourceInfo = null;
if (res != null) {
int resourceId = res.getId();
if (resourceId <= 0) {
logger.error("invalid resourceId, {}", resourceId);
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | resourceInfo = new ResourceInfo();
Resource resource = getResourceById(resourceId);
resourceInfo.setId(resourceId);
resourceInfo.setRes(resource.getFileName());
resourceInfo.setResourceName(resource.getFullName());
if (logger.isInfoEnabled()) {
logger.info("updated resource info {}",
JSONUtils.toJsonString(resourceInfo));
}
}
return resourceInfo;
}
/**
* get id list by task state
*
* @param instanceId instanceId
* @param state state
* @return task instance states
*/
@Override
public List<Integer> findTaskIdByInstanceState(int instanceId, ExecutionStatus state) {
return taskInstanceMapper.queryTaskByProcessIdAndState(instanceId, state.ordinal());
}
/**
* find valid task list by process definition id
*
* @param processInstanceId processInstanceId
* @return task instance list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public List<TaskInstance> findValidTaskListByProcessId(Integer processInstanceId) {
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.YES);
}
/**
* find previous task list by work process id
*
* @param processInstanceId processInstanceId
* @return task instance list
*/
@Override
public List<TaskInstance> findPreviousTaskListByWorkProcessId(Integer processInstanceId) {
return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.NO);
}
/**
* update work process instance map
*
* @param processInstanceMap processInstanceMap
* @return update process instance result
*/
@Override
public int updateWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap) {
return processInstanceMapMapper.updateById(processInstanceMap);
}
/**
* create work process instance map
*
* @param processInstanceMap processInstanceMap
* @return create process instance result
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public int createWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap) {
int count = 0;
if (processInstanceMap != null) {
return processInstanceMapMapper.insert(processInstanceMap);
}
return count;
}
/**
* find work process map by parent process id and parent task id.
*
* @param parentWorkProcessId parentWorkProcessId
* @param parentTaskId parentTaskId
* @return process instance map
*/
@Override
public ProcessInstanceMap findWorkProcessMapByParent(Integer parentWorkProcessId, Integer parentTaskId) {
return processInstanceMapMapper.queryByParentId(parentWorkProcessId, parentTaskId);
}
/**
* delete work process map by parent process id
*
* @param parentWorkProcessId parentWorkProcessId
* @return delete process map result
*/
@Override
public int deleteWorkProcessMapByParentId(int parentWorkProcessId) {
return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * find sub process instance
*
* @param parentProcessId parentProcessId
* @param parentTaskId parentTaskId
* @return process instance
*/
@Override
public ProcessInstance findSubProcessInstance(Integer parentProcessId, Integer parentTaskId) {
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryByParentId(parentProcessId, parentTaskId);
if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) {
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getProcessInstanceId());
return processInstance;
}
/**
* find parent process instance
*
* @param subProcessId subProcessId
* @return process instance
*/
@Override
public ProcessInstance findParentProcessInstance(Integer subProcessId) {
ProcessInstance processInstance = null;
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(subProcessId);
if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) {
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return processInstance;
}
/**
* update process instance
*
* @param processInstance processInstance
* @return update process instance result
*/
@Override
public int updateProcessInstance(ProcessInstance processInstance) {
return processInstanceMapper.updateById(processInstance);
}
/**
* for show in page of taskInstance
*/
@Override
public void changeOutParam(TaskInstance taskInstance) {
if (Strings.isNullOrEmpty(taskInstance.getVarPool())) {
return;
}
List<Property> properties = JSONUtils.toList(taskInstance.getVarPool(), Property.class);
if (CollectionUtils.isEmpty(properties)) {
return;
}
Map<String, Object> taskParams = JSONUtils.parseObject(taskInstance.getTaskParams(), new TypeReference<Map<String, Object>>() {
});
Object localParams = taskParams.get(LOCAL_PARAMS);
if (localParams == null) {
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class);
Map<String, String> outProperty = new HashMap<>();
for (Property info : properties) {
if (info.getDirect() == Direct.OUT) {
outProperty.put(info.getProp(), info.getValue());
}
}
for (Property info : allParam) {
if (info.getDirect() == Direct.OUT) {
String paramName = info.getProp();
info.setValue(outProperty.get(paramName));
}
}
taskParams.put(LOCAL_PARAMS, allParam);
taskInstance.setTaskParams(JSONUtils.toJsonString(taskParams));
}
/**
* convert integer list to string list
*
* @param intList intList
* @return string list
*/
@Override
public List<String> convertIntListToString(List<Integer> intList) {
if (intList == null) {
return new ArrayList<>();
}
List<String> result = new ArrayList<>(intList.size());
for (Integer intVar : intList) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | result.add(String.valueOf(intVar));
}
return result;
}
/**
* query schedule by id
*
* @param id id
* @return schedule
*/
@Override
public Schedule querySchedule(int id) {
return scheduleMapper.selectById(id);
}
/**
* query Schedule by processDefinitionCode
*
* @param processDefinitionCode processDefinitionCode
* @see Schedule
*/
@Override
public List<Schedule> queryReleaseSchedulerListByProcessDefinitionCode(long processDefinitionCode) {
return scheduleMapper.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode);
}
/**
* query Schedule by processDefinitionCode
*
* @param processDefinitionCodeList processDefinitionCodeList
* @see Schedule
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public Map<Long, String> queryWorkerGroupByProcessDefinitionCodes(List<Long> processDefinitionCodeList) {
List<Schedule> processDefinitionScheduleList = scheduleMapper.querySchedulesByProcessDefinitionCodes(processDefinitionCodeList);
return processDefinitionScheduleList.stream().collect(Collectors.toMap(Schedule::getProcessDefinitionCode,
Schedule::getWorkerGroup));
}
/**
* query dependent process definition by process definition code
*
* @param processDefinitionCode processDefinitionCode
* @see DependentProcessDefinition
*/
@Override
public List<DependentProcessDefinition> queryDependentProcessDefinitionByProcessDefinitionCode(long processDefinitionCode) {
return workFlowLineageMapper.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode);
}
/**
* query need failover process instance
*
* @param host host
* @return process instance list
*/
@Override
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host) {
return processInstanceMapper.queryByHostAndStatus(host, stateArray);
}
@Override
public List<String> queryNeedFailoverProcessInstanceHost() {
return processInstanceMapper.queryNeedFailoverProcessInstanceHost(stateArray);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | /**
* process need failover process instance
*
* @param processInstance processInstance
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public void processNeedFailoverProcessInstances(ProcessInstance processInstance) {
processInstance.setHost(Constants.NULL);
processInstanceMapper.updateById(processInstance);
ProcessDefinition processDefinition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion());
Command cmd = new Command();
cmd.setProcessDefinitionCode(processDefinition.getCode());
cmd.setProcessDefinitionVersion(processDefinition.getVersion());
cmd.setProcessInstanceId(processInstance.getId());
cmd.setCommandParam(String.format("{\"%s\":%d}", Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId()));
cmd.setExecutorId(processInstance.getExecutorId());
cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS);
createCommand(cmd);
}
/**
* query all need failover task instances by host
*
* @param host host
* @return task instance list
*/
@Override
public List<TaskInstance> queryNeedFailoverTaskInstances(String host) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return taskInstanceMapper.queryByHostAndStatus(host,
stateArray);
}
/**
* find data source by id
*
* @param id id
* @return datasource
*/
@Override
public DataSource findDataSourceById(int id) {
return dataSourceMapper.selectById(id);
}
/**
* update process instance state by id
*
* @param processInstanceId processInstanceId
* @param executionStatus executionStatus
* @return update process result
*/
@Override
public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) {
ProcessInstance instance = processInstanceMapper.selectById(processInstanceId);
instance.setState(executionStatus);
return processInstanceMapper.updateById(instance);
}
/**
* find process instance by the task id
*
* @param taskId taskId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @return process instance
*/
@Override
public ProcessInstance findProcessInstanceByTaskId(int taskId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskId);
if (taskInstance != null) {
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
}
return null;
}
/**
* find udf function list by id list string
*
* @param ids ids
* @return udf function list
*/
@Override
public List<UdfFunc> queryUdfFunListByIds(Integer[] ids) {
return udfFuncMapper.queryUdfByIdStr(ids, null);
}
/**
* find tenant code by resource name
*
* @param resName resource name
* @param resourceType resource type
* @return tenant code
*/
@Override
public String queryTenantCodeByResName(String resName, ResourceType resourceType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | String fullName = resName.startsWith("/") ? resName : String.format("/%s", resName);
List<Resource> resourceList = resourceMapper.queryResource(fullName, resourceType.ordinal());
if (CollectionUtils.isEmpty(resourceList)) {
return "";
}
int userId = resourceList.get(0).getUserId();
User user = userMapper.selectById(userId);
if (Objects.isNull(user)) {
return "";
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (Objects.isNull(tenant)) {
return "";
}
return tenant.getTenantCode();
}
/**
* find schedule list by process define codes.
*
* @param codes codes
* @return schedule list
*/
@Override
public List<Schedule> selectAllByProcessDefineCode(long[] codes) {
return scheduleMapper.selectAllByProcessDefineArray(codes);
}
/**
* find last scheduler process instance in the date interval
*
* @param definitionCode definitionCode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @param dateInterval dateInterval
* @return process instance
*/
@Override
public ProcessInstance findLastSchedulerProcessInterval(Long definitionCode, DateInterval dateInterval) {
return processInstanceMapper.queryLastSchedulerProcess(definitionCode,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last manual process instance interval
*
* @param definitionCode process definition code
* @param dateInterval dateInterval
* @return process instance
*/
@Override
public ProcessInstance findLastManualProcessInterval(Long definitionCode, DateInterval dateInterval) {
return processInstanceMapper.queryLastManualProcess(definitionCode,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last running process instance
*
* @param definitionCode process definition code
* @param startTime start time
* @param endTime end time
* @return process instance
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public ProcessInstance findLastRunningProcess(Long definitionCode, Date startTime, Date endTime) {
return processInstanceMapper.queryLastRunningProcess(definitionCode,
startTime,
endTime,
stateArray);
}
/**
* query user queue by process instance
*
* @param processInstance processInstance
* @return queue
*/
@Override
public String queryUserQueueByProcessInstance(ProcessInstance processInstance) {
String queue = "";
if (processInstance == null) {
return queue;
}
User executor = userMapper.selectById(processInstance.getExecutorId());
if (executor != null) {
queue = executor.getQueue();
}
return queue;
}
/**
* query project name and user name by processInstanceId.
*
* @param processInstanceId processInstanceId
* @return projectName and userName |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
public ProjectUser queryProjectWithUserByProcessInstanceId(int processInstanceId) {
return projectMapper.queryProjectWithUserByProcessInstanceId(processInstanceId);
}
/**
* get task worker group
*
* @param taskInstance taskInstance
* @return workerGroupId
*/
@Override
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup();
if (!Strings.isNullOrEmpty(workerGroup)) {
return workerGroup;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if (processInstance != null) {
return processInstance.getWorkerGroup();
}
logger.info("task : {} will use default worker group", taskInstance.getId());
return Constants.DEFAULT_WORKER_GROUP;
}
/**
* get have perm project list
*
* @param userId userId
* @return project list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
public List<Project> getProjectListHavePerm(int userId) {
List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
if (createProjects == null) {
createProjects = new ArrayList<>();
}
if (authedProjects != null) {
createProjects.addAll(authedProjects);
}
return createProjects;
}
/**
* list unauthorized udf function
*
* @param userId user id
* @param needChecks data source id array
* @return unauthorized udf function list
*/
@Override
public <T> List<T> listUnauthorized(int userId, T[] needChecks, AuthorizationType authorizationType) {
List<T> resultList = new ArrayList<>();
if (Objects.nonNull(needChecks) && needChecks.length > 0) {
Set<T> originResSet = new HashSet<>(Arrays.asList(needChecks));
switch (authorizationType) {
case RESOURCE_FILE_ID:
case UDF_FILE:
List<Resource> ownUdfResources = resourceMapper.listAuthorizedResourceById(userId, needChecks);
addAuthorizedResources(ownUdfResources, userId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | Set<Integer> authorizedResourceFiles = ownUdfResources.stream().map(Resource::getId).collect(toSet());
originResSet.removeAll(authorizedResourceFiles);
break;
case RESOURCE_FILE_NAME:
List<Resource> ownResources = resourceMapper.listAuthorizedResource(userId, needChecks);
addAuthorizedResources(ownResources, userId);
Set<String> authorizedResources = ownResources.stream().map(Resource::getFullName).collect(toSet());
originResSet.removeAll(authorizedResources);
break;
case DATASOURCE:
Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId, needChecks).stream().map(DataSource::getId).collect(toSet());
originResSet.removeAll(authorizedDatasources);
break;
case UDF:
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet());
originResSet.removeAll(authorizedUdfs);
break;
default:
break;
}
resultList.addAll(originResSet);
}
return resultList;
}
/**
* get user by user id
*
* @param userId user id
* @return User
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public User getUserById(int userId) {
return userMapper.selectById(userId);
}
/**
* get resource by resource id
*
* @param resourceId resource id
* @return Resource
*/
@Override
public Resource getResourceById(int resourceId) {
return resourceMapper.selectById(resourceId);
}
/**
* list resources by ids
*
* @param resIds resIds
* @return resource list
*/
@Override
public List<Resource> listResourceByIds(Integer[] resIds) {
return resourceMapper.listResourceByIds(resIds);
}
/**
* format task app id in task instance
*/
@Override
public String formatTaskAppId(TaskInstance taskInstance) {
ProcessInstance processInstance = findProcessInstanceById(taskInstance.getProcessInstanceId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (processInstance == null) {
return "";
}
ProcessDefinition definition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion());
if (definition == null) {
return "";
}
return String.format("%s_%s_%s", definition.getId(), processInstance.getId(), taskInstance.getId());
}
/**
* switch process definition version to process definition log version
*/
@Override
public int switchVersion(ProcessDefinition processDefinition, ProcessDefinitionLog processDefinitionLog) {
if (null == processDefinition || null == processDefinitionLog) {
return Constants.DEFINITION_FAILURE;
}
processDefinitionLog.setId(processDefinition.getId());
processDefinitionLog.setReleaseState(ReleaseState.OFFLINE);
processDefinitionLog.setFlag(Flag.YES);
int result = processDefineMapper.updateById(processDefinitionLog);
if (result > 0) {
result = switchProcessTaskRelationVersion(processDefinitionLog);
if (result <= 0) {
return Constants.EXIT_CODE_FAILURE;
}
}
return result;
}
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | public int switchProcessTaskRelationVersion(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
if (!processTaskRelationList.isEmpty()) {
processTaskRelationMapper.deleteByCode(processDefinition.getProjectCode(), processDefinition.getCode());
}
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
int batchInsert = processTaskRelationMapper.batchInsert(processTaskRelationLogList);
if (batchInsert == 0) {
return Constants.EXIT_CODE_FAILURE;
} else {
int result = 0;
for (ProcessTaskRelationLog taskRelationLog : processTaskRelationLogList) {
int switchResult = switchTaskDefinitionVersion(taskRelationLog.getPostTaskCode(), taskRelationLog.getPostTaskVersion());
if (switchResult != Constants.EXIT_CODE_FAILURE) {
result++;
}
}
return result;
}
}
@Override
public int switchTaskDefinitionVersion(long taskCode, int taskVersion) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
return Constants.EXIT_CODE_FAILURE;
}
if (taskDefinition.getVersion() == taskVersion) {
return Constants.EXIT_CODE_SUCCESS;
}
TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskVersion); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (taskDefinitionUpdate == null) {
return Constants.EXIT_CODE_FAILURE;
}
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
return taskDefinitionMapper.updateById(taskDefinitionUpdate);
}
/**
* get resource ids
*
* @param taskDefinition taskDefinition
* @return resource ids
*/
@Override
public String getResourceIds(TaskDefinition taskDefinition) {
Set<Integer> resourceIds = null;
AbstractParameters params = taskPluginManager.getParameters(ParametersNode.builder().taskType(taskDefinition.getTaskType()).taskParams(taskDefinition.getTaskParams()).build());
if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) {
resourceIds = params.getResourceFilesList().
stream()
.filter(t -> t.getId() != 0)
.map(ResourceInfo::getId)
.collect(toSet());
}
if (CollectionUtils.isEmpty(resourceIds)) {
return "";
}
return Joiner.on(",").join(resourceIds);
}
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | public int saveTaskDefine(User operator, long projectCode, List<TaskDefinitionLog> taskDefinitionLogs, Boolean syncDefine) {
Date now = new Date();
List<TaskDefinitionLog> newTaskDefinitionLogs = new ArrayList<>();
List<TaskDefinitionLog> updateTaskDefinitionLogs = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperateTime(now);
taskDefinitionLog.setOperator(operator.getId());
taskDefinitionLog.setResourceIds(getResourceIds(taskDefinitionLog));
if (taskDefinitionLog.getCode() == 0) {
try {
taskDefinitionLog.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
return Constants.DEFINITION_FAILURE;
}
}
if (taskDefinitionLog.getVersion() == 0) {
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
}
TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper
.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion());
if (definitionCodeAndVersion == null) {
taskDefinitionLog.setUserId(operator.getId());
taskDefinitionLog.setCreateTime(now);
newTaskDefinitionLogs.add(taskDefinitionLog);
continue;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (taskDefinitionLog.equals(definitionCodeAndVersion)) {
continue;
}
taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
taskDefinitionLog.setVersion(version + 1);
taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
updateTaskDefinitionLogs.add(taskDefinitionLog);
}
int insertResult = 0;
int updateResult = 0;
for (TaskDefinitionLog taskDefinitionToUpdate : updateTaskDefinitionLogs) {
TaskDefinition task = taskDefinitionMapper.queryByCode(taskDefinitionToUpdate.getCode());
if (task == null) {
newTaskDefinitionLogs.add(taskDefinitionToUpdate);
} else {
insertResult += taskDefinitionLogMapper.insert(taskDefinitionToUpdate);
if (Boolean.TRUE.equals(syncDefine)) {
taskDefinitionToUpdate.setId(task.getId());
updateResult += taskDefinitionMapper.updateById(taskDefinitionToUpdate);
} else {
updateResult++;
}
}
}
if (!newTaskDefinitionLogs.isEmpty()) {
insertResult += taskDefinitionLogMapper.batchInsert(newTaskDefinitionLogs);
if (Boolean.TRUE.equals(syncDefine)) {
updateResult += taskDefinitionMapper.batchInsert(newTaskDefinitionLogs); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | } else {
updateResult += newTaskDefinitionLogs.size();
}
}
return (insertResult & updateResult) > 0 ? 1 : Constants.EXIT_CODE_SUCCESS;
}
/**
* save processDefinition (including create or update processDefinition)
*/
@Override
public int saveProcessDefine(User operator, ProcessDefinition processDefinition, Boolean syncDefine, Boolean isFromProcessDefine) {
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition);
Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinition.getCode());
int insertVersion = version == null || version == 0 ? Constants.VERSION_FIRST : version + 1;
processDefinitionLog.setVersion(insertVersion);
processDefinitionLog.setReleaseState(!isFromProcessDefine || processDefinitionLog.getReleaseState() == ReleaseState.ONLINE ? ReleaseState.ONLINE : ReleaseState.OFFLINE);
processDefinitionLog.setOperator(operator.getId());
processDefinitionLog.setOperateTime(processDefinition.getUpdateTime());
int insertLog = processDefineLogMapper.insert(processDefinitionLog);
int result = 1;
if (Boolean.TRUE.equals(syncDefine)) {
if (0 == processDefinition.getId()) {
result = processDefineMapper.insert(processDefinitionLog);
} else {
processDefinitionLog.setId(processDefinition.getId());
result = processDefineMapper.updateById(processDefinitionLog);
}
}
return (insertLog & result) > 0 ? insertVersion : 0;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | /**
* save task relations
*/
@Override
public int saveTaskRelation(User operator, long projectCode, long processDefinitionCode, int processDefinitionVersion,
List<ProcessTaskRelationLog> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs,
Boolean syncDefine) {
if (taskRelationList.isEmpty()) {
return Constants.EXIT_CODE_SUCCESS;
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = null;
if (CollectionUtils.isNotEmpty(taskDefinitionLogs)) {
taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinition::getCode, taskDefinitionLog -> taskDefinitionLog));
}
Date now = new Date();
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
processTaskRelationLog.setProjectCode(projectCode);
processTaskRelationLog.setProcessDefinitionCode(processDefinitionCode);
processTaskRelationLog.setProcessDefinitionVersion(processDefinitionVersion);
if (taskDefinitionLogMap != null) {
TaskDefinitionLog preTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPreTaskCode());
if (preTaskDefinitionLog != null) {
processTaskRelationLog.setPreTaskVersion(preTaskDefinitionLog.getVersion());
}
TaskDefinitionLog postTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPostTaskCode());
if (postTaskDefinitionLog != null) {
processTaskRelationLog.setPostTaskVersion(postTaskDefinitionLog.getVersion());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | processTaskRelationLog.setCreateTime(now);
processTaskRelationLog.setUpdateTime(now);
processTaskRelationLog.setOperator(operator.getId());
processTaskRelationLog.setOperateTime(now);
}
int insert = taskRelationList.size();
if (Boolean.TRUE.equals(syncDefine)) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
if (!processTaskRelationList.isEmpty()) {
Set<Integer> processTaskRelationSet = processTaskRelationList.stream().map(ProcessTaskRelation::hashCode).collect(toSet());
Set<Integer> taskRelationSet = taskRelationList.stream().map(ProcessTaskRelationLog::hashCode).collect(toSet());
boolean result = CollectionUtils.isEqualCollection(processTaskRelationSet, taskRelationSet);
if (result) {
return Constants.EXIT_CODE_SUCCESS;
}
processTaskRelationMapper.deleteByCode(projectCode, processDefinitionCode);
}
insert = processTaskRelationMapper.batchInsert(taskRelationList);
}
int resultLog = processTaskRelationLogMapper.batchInsert(taskRelationList);
return (insert & resultLog) > 0 ? Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE;
}
@Override
public boolean isTaskOnline(long taskCode) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByTaskCode(taskCode);
if (!processTaskRelationList.isEmpty()) {
Set<Long> processDefinitionCodes = processTaskRelationList
.stream()
.map(ProcessTaskRelation::getProcessDefinitionCode)
.collect(toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | List<ProcessDefinition> processDefinitionList = processDefineMapper.queryByCodes(processDefinitionCodes);
for (ProcessDefinition processDefinition : processDefinitionList) {
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
return true;
}
}
}
return false;
}
/**
* Generate the DAG Graph based on the process definition id
* Use temporarily before refactoring taskNode
*
* @param processDefinition process definition
* @return dag graph
*/
@Override
public DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion());
List<TaskNode> taskNodeList = transformTask(taskRelations, Lists.newArrayList());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList, new ArrayList<>(taskRelations));
return DagHelper.buildDagGraph(processDag);
}
/**
* generate DagData
*/
@Override
public DagData genDagData(ProcessDefinition processDefinition) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion());
List<TaskDefinitionLog> taskDefinitionLogList = genTaskDefineList(taskRelations);
List<TaskDefinition> taskDefinitions = taskDefinitionLogList.stream().map(t -> (TaskDefinition) t).collect(Collectors.toList());
return new DagData(processDefinition, taskRelations, taskDefinitions);
}
@Override
public List<TaskDefinitionLog> genTaskDefineList(List<ProcessTaskRelation> processTaskRelations) {
Set<TaskDefinition> taskDefinitionSet = new HashSet<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPreTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion()));
}
if (processTaskRelation.getPostTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion()));
}
}
if (taskDefinitionSet.isEmpty()) {
return Lists.newArrayList();
}
return taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionSet);
}
@Override
public List<TaskDefinitionLog> getTaskDefineLogListByRelation(List<ProcessTaskRelation> processTaskRelations) {
List<TaskDefinitionLog> taskDefinitionLogs = new ArrayList<>();
Map<Long, Integer> taskCodeVersionMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPreTaskCode() > 0) {
taskCodeVersionMap.put(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion());
}
if (processTaskRelation.getPostTaskCode() > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | taskCodeVersionMap.put(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion());
}
}
taskCodeVersionMap.forEach((code, version) -> {
taskDefinitionLogs.add((TaskDefinitionLog) this.findTaskDefinition(code, version));
});
return taskDefinitionLogs;
}
/**
* find task definition by code and version
*/
@Override
public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersion) {
return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion);
}
/**
* find process task relation list by process
*/
@Override
public List<ProcessTaskRelation> findRelationByCode(long processDefinitionCode, int processDefinitionVersion) {
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinitionCode, processDefinitionVersion);
return processTaskRelationLogList.stream().map(r -> (ProcessTaskRelation) r).collect(Collectors.toList());
}
/**
* add authorized resources
*
* @param ownResources own resources
* @param userId userId
*/
private void addAuthorizedResources(List<Resource> ownResources, int userId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | List<Integer> relationResourceIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 7);
List<Resource> relationResources = CollectionUtils.isNotEmpty(relationResourceIds) ? resourceMapper.queryResourceListById(relationResourceIds) : new ArrayList<>();
ownResources.addAll(relationResources);
}
/**
* Use temporarily before refactoring taskNode
*/
@Override
public List<TaskNode> transformTask(List<ProcessTaskRelation> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<Long, List<Long>> taskCodeMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
taskCodeMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> {
if (v == null) {
v = new ArrayList<>();
}
if (processTaskRelation.getPreTaskCode() != 0L) {
v.add(processTaskRelation.getPreTaskCode());
}
return v;
});
}
if (CollectionUtils.isEmpty(taskDefinitionLogs)) {
taskDefinitionLogs = genTaskDefineList(taskRelationList);
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
List<TaskNode> taskNodeList = new ArrayList<>();
for (Entry<Long, List<Long>> code : taskCodeMap.entrySet()) {
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMap.get(code.getKey());
if (taskDefinitionLog != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | TaskNode taskNode = new TaskNode();
taskNode.setCode(taskDefinitionLog.getCode());
taskNode.setVersion(taskDefinitionLog.getVersion());
taskNode.setName(taskDefinitionLog.getName());
taskNode.setDesc(taskDefinitionLog.getDescription());
taskNode.setType(taskDefinitionLog.getTaskType().toUpperCase());
taskNode.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN);
taskNode.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes());
taskNode.setRetryInterval(taskDefinitionLog.getFailRetryInterval());
Map<String, Object> taskParamsMap = taskNode.taskParamsToJsonObj(taskDefinitionLog.getTaskParams());
taskNode.setConditionResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.CONDITION_RESULT)));
taskNode.setSwitchResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.SWITCH_RESULT)));
taskNode.setDependence(JSONUtils.toJsonString(taskParamsMap.get(Constants.DEPENDENCE)));
taskParamsMap.remove(Constants.CONDITION_RESULT);
taskParamsMap.remove(Constants.DEPENDENCE);
taskNode.setParams(JSONUtils.toJsonString(taskParamsMap));
taskNode.setTaskInstancePriority(taskDefinitionLog.getTaskPriority());
taskNode.setWorkerGroup(taskDefinitionLog.getWorkerGroup());
taskNode.setEnvironmentCode(taskDefinitionLog.getEnvironmentCode());
taskNode.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN,
taskDefinitionLog.getTimeoutNotifyStrategy(),
taskDefinitionLog.getTimeout())));
taskNode.setDelayTime(taskDefinitionLog.getDelayTime());
taskNode.setPreTasks(JSONUtils.toJsonString(code.getValue().stream().map(taskDefinitionLogMap::get).map(TaskDefinition::getCode).collect(Collectors.toList())));
taskNode.setTaskGroupId(taskDefinitionLog.getTaskGroupId());
taskNode.setTaskGroupPriority(taskDefinitionLog.getTaskGroupPriority());
taskNode.setCpuQuota(taskDefinitionLog.getCpuQuota());
taskNode.setMemoryMax(taskDefinitionLog.getMemoryMax());
taskNodeList.add(taskNode);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
return taskNodeList;
}
@Override
public Map<ProcessInstance, TaskInstance> notifyProcessList(int processId) {
HashMap<ProcessInstance, TaskInstance> processTaskMap = new HashMap<>();
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(processId);
if (processInstanceMap == null) {
return processTaskMap;
}
ProcessInstance fatherProcess = this.findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
TaskInstance fatherTask = this.findTaskInstanceById(processInstanceMap.getParentTaskInstanceId());
if (fatherProcess != null) {
processTaskMap.put(fatherProcess, fatherTask);
}
return processTaskMap;
}
@Override
public DqExecuteResult getDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.getExecuteResultById(taskInstanceId);
}
@Override
public int updateDqExecuteResultUserId(int taskInstanceId) {
DqExecuteResult dqExecuteResult =
dqExecuteResultMapper.selectOne(new QueryWrapper<DqExecuteResult>().eq(TASK_INSTANCE_ID, taskInstanceId));
if (dqExecuteResult == null) {
return -1;
}
ProcessInstance processInstance = processInstanceMapper.selectById(dqExecuteResult.getProcessInstanceId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (processInstance == null) {
return -1;
}
ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition == null) {
return -1;
}
dqExecuteResult.setProcessDefinitionId(processDefinition.getId());
dqExecuteResult.setUserId(processDefinition.getUserId());
dqExecuteResult.setState(DqTaskState.DEFAULT.getCode());
return dqExecuteResultMapper.updateById(dqExecuteResult);
}
@Override
public int updateDqExecuteResultState(DqExecuteResult dqExecuteResult) {
return dqExecuteResultMapper.updateById(dqExecuteResult);
}
@Override
public int deleteDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.delete(
new QueryWrapper<DqExecuteResult>()
.eq(TASK_INSTANCE_ID, taskInstanceId));
}
@Override
public int deleteTaskStatisticsValueByTaskInstanceId(int taskInstanceId) {
return dqTaskStatisticsValueMapper.delete(
new QueryWrapper<DqTaskStatisticsValue>()
.eq(TASK_INSTANCE_ID, taskInstanceId));
}
@Override
public DqRule getDqRule(int ruleId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return dqRuleMapper.selectById(ruleId);
}
@Override
public List<DqRuleInputEntry> getRuleInputEntry(int ruleId) {
return DqRuleUtils.transformInputEntry(dqRuleInputEntryMapper.getRuleInputEntryList(ruleId));
}
@Override
public List<DqRuleExecuteSql> getDqExecuteSql(int ruleId) {
return dqRuleExecuteSqlMapper.getExecuteSqlList(ruleId);
}
@Override
public DqComparisonType getComparisonTypeById(int id) {
return dqComparisonTypeMapper.selectById(id);
}
/**
* the first time (when submit the task ) get the resource of the task group
*
* @param taskId task id
*/
@Override
public boolean acquireTaskGroup(int taskId,
String taskName, int groupId,
int processId, int priority) {
TaskGroup taskGroup = taskGroupMapper.selectById(groupId);
if (taskGroup == null) {
return true;
}
if (taskGroup.getStatus() == Flag.NO.getCode()) {
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskId);
if (taskGroupQueue == null) {
taskGroupQueue = insertIntoTaskGroupQueue(taskId, taskName, groupId, processId, priority, TaskGroupQueueStatus.WAIT_QUEUE);
} else {
if (taskGroupQueue.getStatus() == TaskGroupQueueStatus.ACQUIRE_SUCCESS) {
return true;
}
taskGroupQueue.setInQueue(Flag.NO.getCode());
taskGroupQueue.setStatus(TaskGroupQueueStatus.WAIT_QUEUE);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
}
List<TaskGroupQueue> highPriorityTasks = taskGroupQueueMapper.queryHighPriorityTasks(groupId, priority, TaskGroupQueueStatus.WAIT_QUEUE.getCode());
if (CollectionUtils.isNotEmpty(highPriorityTasks)) {
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
int count = taskGroupMapper.selectAvailableCountById(groupId);
if (count == 1 && robTaskGroupResouce(taskGroupQueue)) {
return true;
}
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
/**
* try to get the task group resource(when other task release the resource)
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | public boolean robTaskGroupResouce(TaskGroupQueue taskGroupQueue) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskGroupQueue.getGroupId());
int affectedCount = taskGroupMapper.updateTaskGroupResource(taskGroup.getId(), taskGroupQueue.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode());
if (affectedCount > 0) {
taskGroupQueue.setStatus(TaskGroupQueueStatus.ACQUIRE_SUCCESS);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return true;
}
return false;
}
@Override
public boolean acquireTaskGroupAgain(TaskGroupQueue taskGroupQueue) {
return robTaskGroupResouce(taskGroupQueue);
}
@Override
public void releaseAllTaskGroup(int processInstanceId) {
List<TaskInstance> taskInstances = this.taskInstanceMapper.loadAllInfosNoRelease(processInstanceId, TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
for (TaskInstance info : taskInstances) {
releaseTaskGroup(info);
}
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @return the result code and msg
*/
@Override
public TaskInstance releaseTaskGroup(TaskInstance taskInstance) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | TaskGroup taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
if (taskGroup == null) {
return null;
}
TaskGroupQueue thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId());
if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null;
}
try {
while (taskGroupMapper.releaseTaskGroupResource(taskGroup.getId(), taskGroup.getUseSize()
, thisTaskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()) != 1) {
thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId());
if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null;
}
taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
}
} catch (Exception e) {
logger.error("release the task group error", e);
}
logger.info("updateTask:{}", taskInstance.getName());
changeTaskGroupQueueStatus(taskInstance.getId(), TaskGroupQueueStatus.RELEASE);
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
while (this.taskGroupQueueMapper.updateInQueueCAS(Flag.NO.getCode(), Flag.YES.getCode(), taskGroupQueue.getId()) != 1) {
taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (taskGroupQueue == null) {
return null;
}
}
return this.taskInstanceMapper.selectById(taskGroupQueue.getTaskId());
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @param taskId task id
* @return the result code and msg
*/
@Override
public void changeTaskGroupQueueStatus(int taskId, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.queryByTaskId(taskId);
taskGroupQueue.setStatus(status);
taskGroupQueue.setUpdateTime(new Date(System.currentTimeMillis()));
taskGroupQueueMapper.updateById(taskGroupQueue);
}
/**
* insert into task group queue
*
* @param taskId task id
* @param taskName task name
* @param groupId group id
* @param processId process id
* @param priority priority
* @return result and msg code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | public TaskGroupQueue insertIntoTaskGroupQueue(Integer taskId,
String taskName, Integer groupId,
Integer processId, Integer priority, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = new TaskGroupQueue(taskId, taskName, groupId, processId, priority, status);
taskGroupQueue.setCreateTime(new Date());
taskGroupQueue.setUpdateTime(new Date());
taskGroupQueueMapper.insert(taskGroupQueue);
return taskGroupQueue;
}
@Override
public int updateTaskGroupQueueStatus(Integer taskId, int status) {
return taskGroupQueueMapper.updateStatusByTaskId(taskId, status);
}
@Override
public int updateTaskGroupQueue(TaskGroupQueue taskGroupQueue) {
return taskGroupQueueMapper.updateById(taskGroupQueue);
}
@Override
public TaskGroupQueue loadTaskGroupQueue(int taskId) {
return this.taskGroupQueueMapper.queryByTaskId(taskId);
}
@Override
public void sendStartTask2Master(ProcessInstance processInstance, int taskId,
org.apache.dolphinscheduler.remote.command.CommandType taskType) {
String host = processInstance.getHost();
String address = host.split(":")[0];
int port = Integer.parseInt(host.split(":")[1]);
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand(
processInstance.getId(), taskId
); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,452 | [Feature] Serial wait for policy recovery. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Serial wait for policy recovery.
### Use case
Serial wait for policy recovery.
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10452 | https://github.com/apache/dolphinscheduler/pull/10453 | 6396fa996563622a5ded29cbcae42d91db24d611 | f46faa02c39b6c31c345fdc75218b3fc15f64ae3 | 2022-06-15T07:04:51Z | java | 2022-06-22T06:28:50Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | stateEventCallbackService.sendResult(address, port, taskEventChangeCommand.convert2Command(taskType));
}
@Override
public ProcessInstance loadNextProcess4Serial(long code, int state, int id) {
return this.processInstanceMapper.loadNextProcess4Serial(code, state, id);
}
protected void deleteCommandWithCheck(int commandId) {
int delete = this.commandMapper.deleteById(commandId);
if (delete != 1) {
throw new ServiceException("delete command fail, id:" + commandId);
}
}
/**
* find k8s config yaml by clusterName
*
* @param clusterName clusterName
* @return datasource
*/
@Override
public String findConfigYamlByName(String clusterName) {
if (Strings.isNullOrEmpty(clusterName)) {
return null;
}
QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>();
nodeWrapper.eq("k8s_name", clusterName);
K8s k8s = k8sMapper.selectOne(nodeWrapper);
return k8s.getK8sConfig();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | /*
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | *
* 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.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.TaskGroupQueueService;
import org.apache.dolphinscheduler.api.service.TaskGroupService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* task Group Service
*/
@Service
public class TaskGroupServiceImpl extends BaseServiceImpl implements TaskGroupService {
@Autowired
private TaskGroupMapper taskGroupMapper;
@Autowired
private TaskGroupQueueService taskGroupQueueService;
@Autowired
private ProcessService processService;
@Autowired
private ExecutorService executorService;
private static final Logger logger = LoggerFactory.getLogger(TaskGroupServiceImpl.class);
/**
* create a Task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | */
@Override
public Map<String, Object> createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_CREATE);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result;
}
TaskGroup taskGroup1 = taskGroupMapper.queryByName(loginUser.getId(), name);
if (taskGroup1 != null) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = new TaskGroup(name, projectCode, description,
groupSize, loginUser.getId(), Flag.YES.getCode());
taskGroup.setCreateTime(new Date());
taskGroup.setUpdateTime(new Date());
if (taskGroupMapper.insert(taskGroup) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_TASK_GROUP_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | return result;
}
return result;
}
/**
* update the task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg
*/
@Override
public Map<String, Object> updateTaskGroup(User loginUser, int id, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_EDIT);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result;
}
Integer exists = taskGroupMapper.selectCount(new QueryWrapper<TaskGroup>().lambda() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | .eq(TaskGroup::getName, name)
.eq(TaskGroup::getUserId, loginUser.getId())
.ne(TaskGroup::getId, id));
if (exists > 0) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() != Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_ERROR);
return result;
}
taskGroup.setGroupSize(groupSize);
taskGroup.setDescription(description);
taskGroup.setUpdateTime(new Date());
if (StringUtils.isNotEmpty(name)) {
taskGroup.setName(name);
}
int i = taskGroupMapper.updateById(taskGroup);
logger.info("update result:{}", i);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task group status
*
* @param id task group id
* @return is the task group available
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | public boolean isTheTaskGroupAvailable(int id) {
return taskGroupMapper.selectCountByIdStatus(id, Flag.YES.getCode()) == 1;
}
/**
* query all task group by user id
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @return the result code and msg
*/
@Override
public Map<String, Object> queryAllTaskGroup(User loginUser, String name, Integer status, int pageNo, int pageSize) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), name, status);
}
/**
* query all task group by status
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByStatus(User loginUser, int pageNo, int pageSize, int status) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), null, status);
}
/**
* query all task group by name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | *
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @param projectCode project code
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {
Map<String, Object> result = new HashMap<>();
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_VIEW);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, projectCode);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
private Map<String, Object> getStringObjectMap(int pageNo, int pageSize, Map<String, Object> result, IPage<TaskGroup> taskGroupPaging) {
PageInfo<TaskGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
int total = taskGroupPaging == null ? 0 : (int) taskGroupPaging.getTotal();
List<TaskGroup> list = taskGroupPaging == null ? new ArrayList<TaskGroup>() : taskGroupPaging.getRecords();
pageInfo.setTotal(total);
pageInfo.setTotalList(list);
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * query all task group by id
*
* @param loginUser login user
* @param id id
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupById(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
TaskGroup taskGroup = taskGroupMapper.selectById(id);
result.put(Constants.DATA_LIST, taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query
*
* @param pageNo page no
* @param pageSize page size
* @param userId user id
* @param name name
* @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> doQuery(User loginUser, int pageNo, int pageSize, int userId, String name, Integer status) {
Map<String, Object> result = new HashMap<>();
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
PageInfo<TaskGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.TASK_GROUP, userId, logger); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | if (ids.isEmpty()) {
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPaging(page, new ArrayList<>(ids), name, status);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
/**
* close a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> closeTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_CLOSE);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.NO.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_CLOSED);
return result;
}
taskGroup.setStatus(Flag.NO.getCode());
taskGroupMapper.updateById(taskGroup); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | putMsg(result, Status.SUCCESS);
return result;
}
/**
* start a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> startTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_CLOSE);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_OPENED);
return result;
}
taskGroup.setStatus(Flag.YES.getCode());
taskGroup.setUpdateTime(new Date(System.currentTimeMillis()));
int update = taskGroupMapper.updateById(taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * wake a task manually
*
* @param loginUser
* @param queueId task group queue id
* @return result
*/
@Override
public Map<String, Object> forceStartTask(User loginUser, int queueId) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_QUEUE_START);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
return executorService.forceStartTaskInstance(loginUser, queueId);
}
@Override
public Map<String, Object> modifyPriority(User loginUser, Integer queueId, Integer priority) {
Map<String, Object> result = new HashMap<>();
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_QUEUE_PRIORITY);
if (!canOperatorPermissions){
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
taskGroupQueueService.modifyPriority(queueId, priority);
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java | /*
* 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.dao.mapper;
import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* the Dao interfaces of task group
*
* @author yinrui
* @since 2021-08-07
*/
public interface TaskGroupMapper extends BaseMapper<TaskGroup> { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java | /**
* compard and set to update table of task group
*
* @param id primary key
* @return affected rows
*/
int updateTaskGroupResource(@Param("id") int id, @Param("queueId") int queueId,
@Param("queueStatus") int queueStatus);
/**
* update table of task group
*
* @param id primary key
* @return affected rows
*/
int releaseTaskGroupResource(@Param("id") int id, @Param("useSize") int useSize,
@Param("queueId") int queueId, @Param("queueStatus") int queueStatus); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,556 | [Feature][TaskGroup] TaskGroup should remove query func permission check. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
TaskGroup should remove query func permission check.
### Use case
TaskGroup
### Related issues
No
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10556 | https://github.com/apache/dolphinscheduler/pull/10557 | 0aba68f335a9c582424a8e605b94e29deb6649de | bc4ceda4cf864d068583879ae8f35afdaaefeccb | 2022-06-22T22:39:09Z | java | 2022-06-23T02:00:31Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java | /**
* select task groups paging
*
* @param page page
* @param userId user id
* @param name name
* @param status status
* @return result page
*/
IPage<TaskGroup> queryTaskGroupPaging(IPage<TaskGroup> page, @Param("ids") List<Integer> ids,
@Param("name") String name, @Param("status") Integer status);
/**
* query by task group name
*
* @param userId user id
* @param name name
* @return task group
*/
TaskGroup queryByName(@Param("userId") int userId, @Param("name") String name);
int selectAvailableCountById(@Param("groupId") int groupId);
int selectCountByIdStatus(@Param("id") int id,@Param("status") int status);
IPage<TaskGroup> queryTaskGroupPagingByProjectCode(Page<TaskGroup> page, @Param("projectCode") Long projectCode);
/**
* listAuthorizedResource
* @param userId
* @return
*/
List<TaskGroup> listAuthorizedResource(@Param("userId") int userId);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,547 | [Bug] [data-quality] Table or view not found | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I use the data quality module to check the hive table data(hive table:`test`.`t_view_log`), an error is reported when running the task. The error content is:
org.apache.spark.sql.AnalysisException: Table or view not found:`test`.`t_view_log`;line 1 pos 14;
<img width="1627" alt="exception" src="https://user-images.githubusercontent.com/19662221/174990552-3df7b6c9-2d79-435a-8eab-80ae98732aee.png">
### What you expected to happen
Because I have installed spark2.4.0 and hive3.1.2, started the hive Metastore service, and set hive-site.xml is placed in the conf directory of spark。
### How to reproduce
installed spark2.4.0 and hive3.1.2, started the hive Metastore service, and set hive-site.xml is placed in the conf directory of spark。Then create a new data quality task to check the hive table data。
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10547 | https://github.com/apache/dolphinscheduler/pull/10549 | 773ebc9e523d1190dcc31ce63878071d3d2847c1 | 08e2c245a86e93abd1fcd401ac08a92ba861d523 | 2022-06-22T09:04:32Z | java | 2022-06-23T06:17:45Z | dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/execution/SparkRuntimeEnvironment.java | /*
* 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.data.quality.execution;
import org.apache.dolphinscheduler.data.quality.config.Config;
import org.apache.spark.SparkConf;
import org.apache.spark.sql.SparkSession;
/**
* The SparkRuntimeEnvironment is responsible for creating SparkSession and SparkExecution
*/
public class SparkRuntimeEnvironment {
private static final String TYPE = "type";
private static final String BATCH = "batch";
private SparkSession sparkSession;
private Config config = new Config(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,547 | [Bug] [data-quality] Table or view not found | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I use the data quality module to check the hive table data(hive table:`test`.`t_view_log`), an error is reported when running the task. The error content is:
org.apache.spark.sql.AnalysisException: Table or view not found:`test`.`t_view_log`;line 1 pos 14;
<img width="1627" alt="exception" src="https://user-images.githubusercontent.com/19662221/174990552-3df7b6c9-2d79-435a-8eab-80ae98732aee.png">
### What you expected to happen
Because I have installed spark2.4.0 and hive3.1.2, started the hive Metastore service, and set hive-site.xml is placed in the conf directory of spark。
### How to reproduce
installed spark2.4.0 and hive3.1.2, started the hive Metastore service, and set hive-site.xml is placed in the conf directory of spark。Then create a new data quality task to check the hive table data。
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10547 | https://github.com/apache/dolphinscheduler/pull/10549 | 773ebc9e523d1190dcc31ce63878071d3d2847c1 | 08e2c245a86e93abd1fcd401ac08a92ba861d523 | 2022-06-22T09:04:32Z | java | 2022-06-23T06:17:45Z | dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/execution/SparkRuntimeEnvironment.java | public SparkRuntimeEnvironment(Config config) {
if (config != null) {
this.config = config;
}
this.prepare();
}
public Config getConfig() {
return this.config;
}
public void prepare() {
sparkSession = SparkSession.builder().config(createSparkConf()).getOrCreate();
}
private SparkConf createSparkConf() {
SparkConf conf = new SparkConf();
this.config.entrySet()
.forEach(entry -> conf.set(entry.getKey(), String.valueOf(entry.getValue())));
conf.set("spark.sql.crossJoin.enabled","true");
return conf;
}
public SparkSession sparkSession() {
return sparkSession;
}
public boolean isBatch() {
return BATCH.equalsIgnoreCase(config.getString(TYPE));
}
public SparkBatchExecution getBatchExecution() {
return new SparkBatchExecution(this);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | /*
* 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.api.python;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.HashMap; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dolphinscheduler.api.configuration.PythonGatewayConfiguration;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.QueueService;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.service.TenantService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ComplementDependentMode;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.RunMode;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.Queue;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import py4j.GatewayServer;
@Component
public class PythonGateway {
private static final Logger logger = LoggerFactory.getLogger(PythonGateway.class);
private static final FailureStrategy DEFAULT_FAILURE_STRATEGY = FailureStrategy.CONTINUE;
private static final Priority DEFAULT_PRIORITY = Priority.MEDIUM;
private static final Long DEFAULT_ENVIRONMENT_CODE = -1L;
private static final TaskDependType DEFAULT_TASK_DEPEND_TYPE = TaskDependType.TASK_POST;
private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | private static final int DEFAULT_DRY_RUN = 0;
private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProjectService projectService;
@Autowired
private TenantService tenantService;
@Autowired
private ExecutorService executorService;
@Autowired
private ProcessDefinitionService processDefinitionService;
@Autowired
private TaskDefinitionService taskDefinitionService;
@Autowired
private UsersService usersService;
@Autowired
private QueueService queueService;
@Autowired
private ResourcesService resourceService;
@Autowired
private ProjectMapper projectMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private SchedulerService schedulerService;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private DataSourceMapper dataSourceMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | @Autowired
private PythonGatewayConfiguration pythonGatewayConfiguration;
@Autowired
private ProjectUserMapper projectUserMapper;
private final User dummyAdminUser = new User() {
{
setId(Integer.MAX_VALUE);
setUserName("dummyUser");
setUserType(UserType.ADMIN_USER);
}
};
private final Queue queuePythonGateway = new Queue() {
{
setId(Integer.MAX_VALUE);
setQueueName("queuePythonGateway");
}
};
public String ping() {
return "PONG";
}
public Map<String, Object> genTaskCodeList(Integer genNum) {
return taskDefinitionService.genTaskCodeList(genNum);
}
public Map<String, Long> getCodeAndVersion(String projectName, String processDefinitionName, String taskName) throws CodeGenerateUtils.CodeGenerateException {
Project project = projectMapper.queryByName(projectName);
Map<String, Long> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | if (project == null) {
result.put("code", CodeGenerateUtils.getInstance().genCode());
result.put("version", 0L);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName);
if (processDefinition == null) {
String msg = String.format("Can not find valid process definition by name %s", processDefinitionName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), processDefinition.getCode(), taskName);
if (taskDefinition == null) {
result.put("code", CodeGenerateUtils.getInstance().genCode());
result.put("version", 0L);
} else {
result.put("code", taskDefinition.getCode());
result.put("version", (long) taskDefinition.getVersion());
}
return result;
}
/**
* create or update process definition.
* If process definition do not exists in Project=`projectCode` would create a new one
* If process definition already exists in Project=`projectCode` would update it
*
* @param userName user name who create or update process definition
* @param projectName project name which process definition belongs to
* @param name process definition name
* @param description description |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | * @param globalParams global params
* @param schedule schedule for process definition, will not set schedule if null,
* and if would always fresh exists schedule if not null
* @param warningType warning type
* @param warningGroupId warning group id
* @param locations locations json object about all tasks
* @param timeout timeout for process definition working, if running time longer than timeout,
* task will mark as fail
* @param workerGroup run task in which worker group
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return create result code
*/
public Long createOrUpdateProcessDefinition(String userName,
String projectName,
String name,
String description,
String globalParams,
String schedule,
String warningType,
int warningGroupId,
String locations,
int timeout,
String workerGroup,
String tenantCode,
int releaseState,
String taskRelationJson,
String taskDefinitionJson, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
User user = usersService.queryUser(userName);
Project project = projectMapper.queryByName(projectName);
long projectCode = project.getCode();
ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, name);
long processDefinitionCode;
if (processDefinition != null) {
processDefinitionCode = processDefinition.getCode();
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
} else {
Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
processDefinitionCode = processDefinition.getCode();
}
if (schedule != null) {
createOrUpdateSchedule(user, projectCode, processDefinitionCode, schedule, workerGroup, warningType, warningGroupId);
}
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.getEnum(releaseState));
return processDefinitionCode;
}
/**
* get process definition
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | * @param user user who create or update schedule
* @param projectCode project which process definition belongs to
* @param processDefinitionName process definition name
*/
private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) {
Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, processDefinitionName);
Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS);
ProcessDefinition processDefinition = null;
if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) {
processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
} else if (verifyStatus != Status.SUCCESS) {
String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST.";
logger.error(msg);
throw new RuntimeException(msg);
}
return processDefinition;
}
/**
* create or update process definition schedule.
* It would always use latest schedule define in workflow-as-code, and set schedule online when
* it's not null
*
* @param user user who create or update schedule
* @param projectCode project which process definition belongs to
* @param processDefinitionCode process definition code
* @param schedule schedule expression
* @param workerGroup work group
* @param warningType warning type
* @param warningGroupId warning group id
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | private void createOrUpdateSchedule(User user,
long projectCode,
long processDefinitionCode,
String schedule,
String workerGroup,
String warningType,
int warningGroupId) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode);
int scheduleId;
if (scheduleObj == null) {
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE);
Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, WarningType.valueOf(warningType),
warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
scheduleId = (int) result.get("scheduleId");
} else {
scheduleId = scheduleObj.getId();
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, WarningType.valueOf(warningType),
warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
}
schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE);
}
public void execProcessInstance(String userName,
String projectName,
String processDefinitionName,
String cronTime,
String workerGroup,
String warningType,
int warningGroupId, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | Integer timeout
) {
User user = usersService.queryUser(userName);
Project project = projectMapper.queryByName(projectName);
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName);
processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE);
executorService.execProcessInstance(user,
project.getCode(),
processDefinition.getCode(),
cronTime,
null,
DEFAULT_FAILURE_STRATEGY,
null,
DEFAULT_TASK_DEPEND_TYPE,
WarningType.valueOf(warningType),
warningGroupId,
DEFAULT_RUN_MODE,
DEFAULT_PRIORITY,
workerGroup,
DEFAULT_ENVIRONMENT_CODE,
timeout,
null,
null,
DEFAULT_DRY_RUN,
COMPLEMENT_DEPENDENT_MODE
);
}
/* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | Grant project's permission to user. Use when project's created user not current but
Python API use it to change process definition.
*/
private Integer grantProjectToUser(Project project, User user) {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(user.getId());
projectUser.setProjectId(project.getId());
projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
return projectUserMapper.insert(projectUser);
}
/*
Grant or create project. Create a new project if project do not exists, and grant the project
permission to user if project exists but without permission to this user.
*/
public void createOrGrantProject(String userName, String name, String desc) {
User user = usersService.queryUser(userName);
Project project;
project = projectMapper.queryByName(name);
if (project == null) {
projectService.createProject(user, name, desc);
} else if (project.getUserId() != user.getId()) {
ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), user.getId());
if (projectUser == null) {
grantProjectToUser(project, user);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | public Map<String, Object> createQueue(String name, String queueName) {
Result<Object> verifyQueueExists = queueService.verifyQueue(name, queueName);
if (verifyQueueExists.getCode() == 0) {
return queueService.createQueue(dummyAdminUser, name, queueName);
} else {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
}
public Map<String, Object> createTenant(String tenantCode, String desc, String queueName) throws Exception {
if (tenantService.checkTenantExists(tenantCode)) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
} else {
Result<Object> verifyQueueExists = queueService.verifyQueue(queueName, queueName);
if (verifyQueueExists.getCode() == 0) {
queueService.createQueue(dummyAdminUser, queueName, queueName);
}
Map<String, Object> result = queueService.queryQueueName(queueName);
List<Queue> queueList = (List<Queue>) result.get(Constants.DATA_LIST);
Queue queue = queueList.get(0);
return tenantService.createTenant(dummyAdminUser, tenantCode, queue.getId(), desc);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | }
public void createUser(String userName,
String userPassword,
String email,
String phone,
String tenantCode,
String queue,
int state) {
User user = usersService.queryUser(userName);
if (Objects.isNull(user)) {
Map<String, Object> tenantResult = tenantService.queryByTenantCode(tenantCode);
Tenant tenant = (Tenant) tenantResult.get(Constants.DATA_LIST);
usersService.createUser(userName, userPassword, email, tenant.getId(), phone, queue, state);
}
}
/**
* Get datasource by given datasource name. It return map contain datasource id, type, name.
* Useful in Python API create sql task which need datasource information.
*
* @param datasourceName user who create or update schedule
*/
public Map<String, Object> getDatasourceInfo(String datasourceName) {
Map<String, Object> result = new HashMap<>();
List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(datasourceName);
if (dataSourceList == null || dataSourceList.isEmpty()) {
String msg = String.format("Can not find any datasource by name %s", datasourceName);
logger.error(msg);
throw new IllegalArgumentException(msg);
} else if (dataSourceList.size() > 1) {
String msg = String.format("Get more than one datasource by name %s", datasourceName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | logger.error(msg);
throw new IllegalArgumentException(msg);
} else {
DataSource dataSource = dataSourceList.get(0);
result.put("id", dataSource.getId());
result.put("type", dataSource.getType().name());
result.put("name", dataSource.getName());
}
return result;
}
/**
* Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code.
* Useful in Python API create subProcess task which need processDefinition information.
*
* @param userName user who create or update schedule
* @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name
*/
public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) {
Map<String, Object> result = new HashMap<>();
User user = usersService.queryUser(userName);
Project project = (Project) projectService.queryByName(user, projectName).get(Constants.DATA_LIST);
long projectCode = project.getCode();
ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, processDefinitionName);
if (processDefinition != null) {
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinition.getCode(), ReleaseState.ONLINE);
result.put("id", processDefinition.getId());
result.put("name", processDefinition.getName()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | result.put("code", processDefinition.getCode());
} else {
String msg = String.format("Can not find valid process definition by name %s", processDefinitionName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
return result;
}
/**
* Get project, process definition, task code.
* Useful in Python API create dependent task which need processDefinition information.
*
* @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name
* @param taskName task name
*/
public Map<String, Object> getDependentInfo(String projectName, String processDefinitionName, String taskName) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
if (project == null) {
String msg = String.format("Can not find valid project by name %s", projectName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
long projectCode = project.getCode();
result.put("projectCode", projectCode);
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition == null) {
String msg = String.format("Can not find valid process definition by name %s", processDefinitionName);
logger.error(msg); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | throw new IllegalArgumentException(msg);
}
result.put("processDefinitionCode", processDefinition.getCode());
if (taskName != null) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(projectCode, processDefinition.getCode(), taskName);
result.put("taskDefinitionCode", taskDefinition.getCode());
}
return result;
}
/**
* Get resource by given program type and full name. It return map contain resource id, name.
* Useful in Python API create flink or spark task which need processDefinition information.
*
* @param programType program type one of SCALA, JAVA and PYTHON
* @param fullName full name of the resource
*/
public Map<String, Object> getResourcesFileInfo(String programType, String fullName) {
Map<String, Object> result = new HashMap<>();
Result<Object> resources = resourceService.queryResourceByProgramType(dummyAdminUser, ResourceType.FILE, ProgramType.valueOf(programType));
List<ResourceComponent> resourcesComponent = (List<ResourceComponent>) resources.getData();
List<ResourceComponent> namedResources = resourcesComponent.stream().filter(s -> fullName.equals(s.getFullName())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(namedResources)) {
String msg = String.format("Can not find valid resource by program type %s and name %s", programType, fullName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
result.put("id", namedResources.get(0).getId());
result.put("name", namedResources.get(0).getName());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java | @PostConstruct
public void init() {
if (pythonGatewayConfiguration.getEnabled()) {
this.start();
}
}
private void start() {
GatewayServer server;
try {
InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfiguration.getGatewayServerAddress());
InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfiguration.getPythonAddress());
server = new GatewayServer(
this,
pythonGatewayConfiguration.getGatewayServerPort(),
pythonGatewayConfiguration.getPythonPort(),
gatewayHost,
pythonHost,
pythonGatewayConfiguration.getConnectTimeout(),
pythonGatewayConfiguration.getReadTimeout(),
null
);
GatewayServer.turnLoggingOn();
logger.info("PythonGatewayService started on: " + gatewayHost.toString());
server.start();
} catch (UnknownHostException e) {
logger.error("exception occurred while constructing PythonGatewayService().", e);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/python/PythonGatewayTest.java | /*
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/python/PythonGatewayTest.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.api.python;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Date;
import java.util.Map;
/**
* python gate test
*/
@RunWith(MockitoJUnitRunner.class)
public class PythonGatewayTest {
@InjectMocks
private PythonGateway pythonGateway;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProcessDefinitionMapper processDefinitionMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/python/PythonGatewayTest.java | @Mock
private TaskDefinitionMapper taskDefinitionMapper;
@Test
public void testGetCodeAndVersion() throws CodeGenerateUtils.CodeGenerateException {
Project project = getTestProject();
Mockito.when(projectMapper.queryByName(project.getName())).thenReturn(project);
ProcessDefinition processDefinition = getTestProcessDefinition();
Mockito.when(processDefinitionMapper.queryByDefineName(project.getCode(), processDefinition.getName())).thenReturn(processDefinition);
TaskDefinition taskDefinition = getTestTaskDefinition();
Mockito.when(taskDefinitionMapper.queryByName(project.getCode(), processDefinition.getCode(), taskDefinition.getName())).thenReturn(taskDefinition);
Map<String, Long> result = pythonGateway.getCodeAndVersion(project.getName(), processDefinition.getName(), taskDefinition.getName());
Assert.assertEquals(result.get("code").longValue(), taskDefinition.getCode());
}
@Test
public void testGetDependentInfo() {
Project project = getTestProject();
Mockito.when(projectMapper.queryByName(project.getName())).thenReturn(project);
ProcessDefinition processDefinition = getTestProcessDefinition();
Mockito.when(processDefinitionMapper.queryByDefineName(project.getCode(), processDefinition.getName())).thenReturn(processDefinition);
TaskDefinition taskDefinition = getTestTaskDefinition();
Mockito.when(taskDefinitionMapper.queryByName(project.getCode(), processDefinition.getCode(), taskDefinition.getName())).thenReturn(taskDefinition);
Map<String, Object> result = pythonGateway.getDependentInfo(project.getName(), processDefinition.getName(), taskDefinition.getName());
Assert.assertEquals((long) result.get("taskDefinitionCode"), taskDefinition.getCode());
}
private Project getTestProject() {
Project project = new Project();
project.setName("ut-project");
project.setUserId(111);
project.setCode(1L);
project.setCreateTime(new Date()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,486 | [Feature][Python] Python-gate should support the use of full-name definitions for resources. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now when I define a Python task that requires importing resources.
I need to check the id of the resource in the database first.
And then I write code that looks something like this.
```
test_task = Python(
name="测试任务",
resource_list=[{"id": 64}, {"id": 65}, {"id": 66}, {"id": 67}, {"id": 68}],
code=base_info_py_code
)
```
resource_list should be allowed to be defined using the resource full-name .
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10486 | https://github.com/apache/dolphinscheduler/pull/10551 | 393cb648f9c900c43fe8b4273100ae04622e4f02 | 797057336529d3077c42ec689416c08c2e8d14cf | 2022-06-17T05:23:35Z | java | 2022-06-23T14:59:59Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/python/PythonGatewayTest.java | project.setUpdateTime(new Date());
return project;
}
private ProcessDefinition getTestProcessDefinition() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setCode(1L);
processDefinition.setName("ut-process-definition");
processDefinition.setProjectCode(1L);
processDefinition.setUserId(111);
processDefinition.setUpdateTime(new Date());
processDefinition.setCreateTime(new Date());
return processDefinition;
}
private TaskDefinition getTestTaskDefinition() {
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setCode(888888L);
taskDefinition.setName("ut-task-definition");
taskDefinition.setProjectCode(1L);
taskDefinition.setTaskType("SHELL");
taskDefinition.setUserId(111);
taskDefinition.setResourceIds("1");
taskDefinition.setWorkerGroup("default");
taskDefinition.setEnvironmentCode(1L);
taskDefinition.setVersion(1);
taskDefinition.setCreateTime(new Date());
taskDefinition.setUpdateTime(new Date());
return taskDefinition;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | /*
* 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
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | * 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.server.master.runner.task;
import static org.apache.dolphinscheduler.common.Constants.DEPENDENT_SPLIT;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.model.DependentTaskModel;
import org.apache.dolphinscheduler.plugin.task.api.parameters.DependentParameters;
import org.apache.dolphinscheduler.plugin.task.api.utils.DependentUtils;
import org.apache.dolphinscheduler.server.utils.DependentExecute;
import org.apache.dolphinscheduler.server.utils.LogUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.auto.service.AutoService;
/**
* dependent task processor
*/
@AutoService(ITaskProcessor.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | public class DependentTaskProcessor extends BaseTaskProcessor {
private DependentParameters dependentParameters;
/**
* dependent task list
*/
private List<DependentExecute> dependentTaskList = new ArrayList<>();
/**
* depend item result map
* save the result to log file
*/
private Map<String, DependResult> dependResultMap = new HashMap<>();
/**
* dependent date
*/
private Date dependentDate;
DependResult result;
boolean allDependentItemFinished;
@Override
public boolean submitTask() {
this.taskInstance = processService.submitTaskWithRetry(processInstance, taskInstance, maxRetryTimes, commitInterval);
if (this.taskInstance == null) {
return false;
}
this.setTaskExecutionLogger();
taskInstance.setLogPath(LogUtils.getTaskLogPath(taskInstance.getFirstSubmitTime(),
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(),
taskInstance.getProcessInstanceId(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | taskInstance.getId()));
taskInstance.setHost(NetUtils.getAddr(masterConfig.getListenPort()));
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
taskInstance.setStartTime(new Date());
processService.updateTaskInstance(taskInstance);
initDependParameters();
return true;
}
@Override
public boolean runTask() {
if (!allDependentItemFinished) {
allDependentItemFinished = allDependentTaskFinish();
}
if (allDependentItemFinished) {
getTaskDependResult();
endTask();
}
return true;
}
@Override
protected boolean resubmitTask() {
return true;
}
@Override
protected boolean dispatchTask() {
return true;
}
@Override
protected boolean taskTimeout() {
TaskTimeoutStrategy taskTimeoutStrategy = taskInstance.getTaskDefine().getTimeoutNotifyStrategy(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | if (TaskTimeoutStrategy.FAILED != taskTimeoutStrategy
&& TaskTimeoutStrategy.WARNFAILED != taskTimeoutStrategy) {
return true;
}
logger.info("dependent task {} timeout, strategy {} ",
taskInstance.getId(), taskTimeoutStrategy.getDescp());
result = DependResult.FAILED;
endTask();
return true;
}
/**
* init dependent parameters
*/
private void initDependParameters() {
this.dependentParameters = taskInstance.getDependency();
for (DependentTaskModel taskModel : dependentParameters.getDependTaskList()) {
this.dependentTaskList.add(new DependentExecute(taskModel.getDependItemList(), taskModel.getRelation()));
}
if (processInstance.getScheduleTime() != null) {
this.dependentDate = this.processInstance.getScheduleTime();
} else {
this.dependentDate = new Date();
}
}
@Override
protected boolean pauseTask() {
this.taskInstance.setState(ExecutionStatus.PAUSE);
this.taskInstance.setEndTime(new Date());
processService.saveTaskInstance(taskInstance);
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | }
@Override
protected boolean killTask() {
this.taskInstance.setState(ExecutionStatus.KILL);
this.taskInstance.setEndTime(new Date());
processService.saveTaskInstance(taskInstance);
return true;
}
/**
* judge all dependent tasks finish
*
* @return whether all dependent tasks finish
*/
private boolean allDependentTaskFinish() {
boolean finish = true;
for (DependentExecute dependentExecute : dependentTaskList) {
for (Map.Entry<String, DependResult> entry : dependentExecute.getDependResultMap().entrySet()) {
if (!dependResultMap.containsKey(entry.getKey())) {
dependResultMap.put(entry.getKey(), entry.getValue());
logger.info("dependent item complete {} {},{}", DEPENDENT_SPLIT, entry.getKey(), entry.getValue());
}
}
if (!dependentExecute.finish(dependentDate)) {
finish = false;
}
}
return finish;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,279 | [Improvement][Dependent] Dependent node log output optimization | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Dependent node log output optimization
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10279 | https://github.com/apache/dolphinscheduler/pull/10593 | b21e211d2cbf7a2af2307f0a5c63dc9c2b837809 | 397e51fa63b39bc2ec2d68091c5b613aad7fa4ac | 2022-05-29T10:46:13Z | java | 2022-06-24T08:48:58Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java | * get dependent result
*
* @return DependResult
*/
private DependResult getTaskDependResult() {
List<DependResult> dependResultList = new ArrayList<>();
for (DependentExecute dependentExecute : dependentTaskList) {
DependResult dependResult = dependentExecute.getModelDependResult(dependentDate);
dependResultList.add(dependResult);
}
result = DependentUtils.getDependResultForRelation(this.dependentParameters.getRelation(), dependResultList);
logger.info("dependent task completed, dependent result:{}", result);
return result;
}
/**
*
*/
private void endTask() {
ExecutionStatus status;
status = (result == DependResult.SUCCESS) ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE;
taskInstance.setState(status);
taskInstance.setEndTime(new Date());
processService.saveTaskInstance(taskInstance);
}
@Override
public String getType() {
return TASK_TYPE_DEPENDENT;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.