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
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
try {
List<ProcessTaskRelationLog> taskRelationList =
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
if (CollectionUtils.isEmpty(taskRelationList)) {
logger.error("Generate task relation list failed the taskRelation list is empty, taskRelationJson: {}",
taskRelationJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream()
.map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog),
ProcessTaskRelation.class))
.collect(Collectors.toList());
List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode)
.collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
if (CollectionUtils.isNotEmpty(codes)) {
String taskCodes = StringUtils.join(codes, Constants.COMMA);
logger.error("Task definitions do not exist, taskCodes:{}.", taskCodes);
throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCodes);
}
}
if (graphHasCycle(taskNodeList)) {
logger.error("Process DAG has cycle.");
throw new ServiceException(Status.PROCESS_NODE_HAS_CYCLE);
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("The post_task_code or post_task_version of processTaskRelationLog can not be zero, " +
"processTaskRelationLogId:{}.", processTaskRelationLog.getId());
throw new ServiceException(Status.CHECK_PROCESS_TASK_RELATION_ERROR);
}
}
return taskRelationList;
} catch (ServiceException ex) {
throw ex;
} catch (Exception e) {
logger.error("Check task relation list error, meet an unknown exception, given taskRelationJson: {}",
taskRelationJson, e);
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR);
}
}
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return definition simple list
*/
@Override
public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
ArrayNode arrayNode = JSONUtils.createArrayNode();
for (ProcessDefinition processDefinition : processDefinitions) {
ObjectNode processDefinitionNode = JSONUtils.createObjectNode();
processDefinitionNode.put("id", processDefinition.getId());
processDefinitionNode.put("code", processDefinition.getCode());
processDefinitionNode.put("name", processDefinition.getName());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinitionNode.put("projectCode", processDefinition.getProjectCode());
arrayNode.add(processDefinitionNode);
}
result.put(Constants.DATA_LIST, arrayNode);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return process definition page
*/
@Override
public PageInfo<ProcessDefinition> queryProcessDefinitionListPaging(@NonNull User loginUser,
long projectCode,
String searchVal,
String otherParamsJson,
Integer userId,
Integer pageNo,
Integer pageSize) {
Project project = projectMapper.queryByCode(projectCode);
projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION);
PageListingResult<ProcessDefinition> processDefinitionsPageListingResult =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinitionDao.listingProcessDefinition(
pageNo, pageSize, searchVal, userId, projectCode);
List<ProcessDefinition> processDefinitions = processDefinitionsPageListingResult.getRecords();
List<Long> processDefinitionCodes =
processDefinitions.stream().map(ProcessDefinition::getCode).collect(Collectors.toList());
Map<Long, Schedule> scheduleMap = schedulerService.queryScheduleByProcessDefinitionCodes(processDefinitionCodes)
.stream()
.collect(Collectors.toMap(Schedule::getProcessDefinitionCode, Function.identity()));
for (ProcessDefinition pd : processDefinitions) {
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
Schedule schedule = scheduleMap.get(pd.getCode());
pd.setScheduleReleaseState(schedule == null ? null : schedule.getReleaseState());
}
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionsPageListingResult.getTotalCount());
pageInfo.setTotalList(processDefinitions);
return pageInfo;
}
/**
* Filter resource process definitions
*
* @param loginUser login user
* @param workflowFilterRequest workflow filter requests
* @return List process definition
*/
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public PageInfo<ProcessDefinition> filterProcessDefinition(User loginUser,
WorkflowFilterRequest workflowFilterRequest) {
ProcessDefinition processDefinition = workflowFilterRequest.convert2ProcessDefinition();
if (workflowFilterRequest.getProjectName() != null) {
Project project = projectMapper.queryByName(workflowFilterRequest.getProjectName());
projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION);
processDefinition.setProjectCode(project.getCode());
}
Page<ProcessDefinition> page =
new Page<>(workflowFilterRequest.getPageNo(), workflowFilterRequest.getPageSize());
IPage<ProcessDefinition> processDefinitionIPage =
processDefinitionMapper.filterProcessDefinition(page, processDefinition);
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo =
new PageInfo<>(workflowFilterRequest.getPageNo(), workflowFilterRequest.getPageSize());
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
return pageInfo;
}
/**
* query detail of process definition
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processCode:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* query detail of process definition
*
* @param loginUser login user
* @param code process definition code
* @return process definition detail
*/
@Override
public ProcessDefinition getProcessDefinition(User loginUser, long code) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
}
Project project = projectMapper.queryByCode(processDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION);
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
return processDefinition;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
if (processDefinition == null) {
logger.error("Process definition does not exist, projectCode:{}.", projectCode);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return update result code
*/
@Override
@Transactional
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = generateTaskDefinitionList(taskDefinitionJson);
List<ProcessTaskRelationLog> taskRelationList = generateTaskRelationList(taskRelationJson, taskDefinitionLogs);
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (tenant == null) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processCode:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
logger.warn("Process definition is not allowed to be modified due to {}, processDefinitionCode:{}.",
ReleaseState.ONLINE.getDescp(), processDefinition.getCode());
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
logger.warn("Process definition with the same name already exists, processDefinitionCode:{}.",
definition.getCode());
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
ProcessDefinition processDefinitionDeepCopy =
JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId);
processDefinition.setExecutionType(executionType);
return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy,
taskDefinitionLogs, otherParamsJson);
}
/**
* Task want to delete whether used in other task, should throw exception when have be used.
*
* This function avoid delete task already dependencies by other tasks by accident.
*
* @param processDefinition ProcessDefinition you change task definition and task relation
* @param taskRelationList All the latest task relation list from process definition
*/
private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition,
List<ProcessTaskRelationLog> taskRelationList) {
List<ProcessTaskRelation> oldProcessTaskRelationList = processTaskRelationMapper
.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
Set<ProcessTaskRelationLog> oldProcessTaskRelationSet =
oldProcessTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toSet());
StringBuilder sb = new StringBuilder();
for (ProcessTaskRelationLog oldProcessTaskRelation : oldProcessTaskRelationSet) {
boolean oldTaskExists = taskRelationList.stream()
.anyMatch(relation -> oldProcessTaskRelation.getPostTaskCode() == relation.getPostTaskCode());
if (!oldTaskExists) {
Optional<String> taskDepMsg = workFlowLineageService.taskDepOnTaskMsg(
processDefinition.getProjectCode(), oldProcessTaskRelation.getProcessDefinitionCode(),
oldProcessTaskRelation.getPostTaskCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskDepMsg.ifPresent(sb::append);
}
if (sb.length() != 0) {
logger.error("Task cannot be deleted because it is dependent");
throw new ServiceException(sb.toString());
}
}
}
protected Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs,
String otherParamsJson) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(),
taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
logger.error("Update task definitions error, projectCode:{}, processCode:{}.",
processDefinition.getProjectCode(), processDefinition.getCode());
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
boolean isChange = false;
if (processDefinition.equals(processDefinitionDeepCopy) && saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper
.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (taskRelationList.size() == processTaskRelationLogList.size()) {
Set<ProcessTaskRelationLog> taskRelationSet = new HashSet<>(taskRelationList);
Set<ProcessTaskRelationLog> processTaskRelationLogSet = new HashSet<>(processTaskRelationLogList);
if (taskRelationSet.size() == processTaskRelationLogSet.size()) {
taskRelationSet.removeAll(processTaskRelationLogSet);
if (!taskRelationSet.isEmpty()) {
isChange = true;
}
} else {
isChange = true;
}
} else {
isChange = true;
}
} else {
isChange = true;
}
if (isChange) {
logger.info("Process definition needs to be updated, projectCode:{}, processCode:{}, processVersion:{}.",
processDefinition.getProjectCode(), processDefinition.getCode(), processDefinition.getVersion());
processDefinition.setUpdateTime(new Date());
int insertVersion =
processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion <= 0) {
logger.error("Update process definition error, processCode:{}.", processDefinition.getCode());
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
} else
logger.info("Update process definition complete, processCode:{}, processVersion:{}.",
processDefinition.getCode(), insertVersion);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskUsedInOtherTaskValid(processDefinition, taskRelationList);
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
logger.info(
"Update process task relations complete, projectCode:{}, processCode:{}, processVersion:{}.",
processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion);
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
logger.error("Update process task relations error, projectCode:{}, processCode:{}, processVersion:{}.",
processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion);
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
saveOtherRelation(loginUser, processDefinition, result, otherParamsJson);
} else {
logger.info(
"Process definition does not need to be updated because there is no change, projectCode:{}, processCode:{}, processVersion:{}.",
processDefinition.getProjectCode(), processDefinition.getCode(), processDefinition.getVersion());
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
}
return result;
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name,
long processDefinitionCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition =
processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
return result;
}
if (processDefinitionCode != 0 && processDefinitionCode == processDefinition.getCode()) {
putMsg(result, Status.SUCCESS);
return result;
}
logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.",
processDefinition.getName(), processDefinition.getCode());
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim());
return result;
}
@Override
@Transactional
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> batchDeleteProcessDefinitionByCodes(User loginUser, long projectCode, String codes) {
Map<String, Object> result = new HashMap<>();
if (StringUtils.isEmpty(codes)) {
logger.error("Parameter processDefinitionCodes is empty, projectCode is {}.", projectCode);
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY);
return result;
}
Set<Long> definitionCodes = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes =
processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode =
definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
if (!diffCode.isEmpty()) {
logger.error("Process definition does not exist, processCodes:{}.",
diffCode.stream().map(String::valueOf).collect(Collectors.joining(Constants.COMMA)));
throw new ServiceException(Status.BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR,
diffCode.stream().map(code -> code + "[process definition not exist]")
.collect(Collectors.joining(Constants.COMMA))
);
}
for (ProcessDefinition process : processDefinitionList) {
try {
this.deleteProcessDefinitionByCode(loginUser, process.getCode());
} catch (Exception e) {
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_ERROR, process.getName(), e.getMessage());
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Process definition want to delete whether used in other task, should throw exception when have be used.
*
* This function avoid delete process definition already dependencies by other tasks by accident.
*
* @param processDefinition ProcessDefinition you change task definition and task relation
*/
private void processDefinitionUsedInOtherTaskValid(ProcessDefinition processDefinition) {
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
throw new ServiceException(Status.PROCESS_DEFINE_STATE_ONLINE, processDefinition.getName());
}
List<ProcessInstance> processInstances = processInstanceService
.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_EXECUTING_FAIL, processInstances.size());
}
Set<TaskMainInfo> taskDepOnProcess = workFlowLineageService
.queryTaskDepOnProcess(processDefinition.getProjectCode(), processDefinition.getCode());
if (CollectionUtils.isNotEmpty(taskDepOnProcess)) {
String taskDepDetail = taskDepOnProcess.stream()
.map(task -> String.format(Constants.FORMAT_S_S_COLON, task.getProcessDefinitionName(),
task.getTaskName()))
.collect(Collectors.joining(Constants.COMMA));
throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL, taskDepDetail);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
}
/**
* delete process definition by code
*
* @param loginUser login user
* @param code process definition code
*/
@Override
@Transactional
public void deleteProcessDefinitionByCode(User loginUser, long code) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
}
Project project = projectMapper.queryByCode(processDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION_DELETE);
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
processDefinitionUsedInOtherTaskValid(processDefinition);
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj != null) {
if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) {
int delete = scheduleMapper.deleteById(scheduleObj.getId());
if (delete == 0) {
throw new ServiceException(Status.DELETE_SCHEDULE_BY_ID_ERROR);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
}
if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) {
throw new ServiceException(Status.SCHEDULE_STATE_ONLINE, scheduleObj.getId());
}
}
int delete = processDefinitionMapper.deleteById(processDefinition.getId());
if (delete == 0) {
logger.error("Delete process definition error, processDefinitionCode:{}.", code);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode());
if (deleteRelation == 0) {
logger.warn(
"The process definition has not relation, it will be delete successfully, processDefinitionCode:{}.",
code);
}
deleteOtherRelation(project, new HashMap<>(), processDefinition);
}
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code,
ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList =
processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) {
logger.warn("Process definition has no task relation, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinitionMapper.updateById(processDefinition);
logger.info("Set process definition online, projectCode:{}, processDefinitionCode:{}.", projectCode,
code);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code);
if (updateProcess > 0) {
logger.info("Set process definition offline, projectCode:{}, processDefinitionCode:{}.",
projectCode, code);
if (schedule != null) {
schedule.setReleaseState(releaseState);
int updateSchedule = scheduleMapper.updateById(schedule);
if (updateSchedule == 0) {
logger.error(
"Set schedule offline error, projectCode:{}, processDefinitionCode:{}, scheduleId:{}",
projectCode, code, schedule.getId());
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
} else
logger.info("Set schedule offline, projectCode:{}, processDefinitionCode:{}, scheduleId:{}",
projectCode, code, schedule.getId());
schedulerService.deleteSchedule(project.getId(), schedule.getId());
}
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by codes
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes,
HttpServletResponse response) {
if (StringUtils.isEmpty(codes)) {
logger.warn("Process definition codes to be exported is empty.");
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_EXPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.error("Process definitions to be exported do not exist, processDefinitionCodes:{}.", defineCodeSet);
return;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList());
List<DagDataSchedule> dagDataSchedules =
processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(dagDataSchedules)) {
logger.info("Start download process definition file, processDefinitionCodes:{}.", defineCodeSet);
downloadProcessDefinitionFile(response, dagDataSchedules);
} else
logger.error("There is no exported process dag data.");
}
/**
* download the process definition file
*/
protected void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("Export process definition fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
logger.warn("Buffer does not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("Output stream does not close", e);
}
}
}
}
/**
* get export process dag data
*
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (scheduleObj != null) {
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(scheduleObj);
}
return dagDataSchedule;
}
/**
* import process definition
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
@Override
@Transactional
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result;
String dagDataScheduleJson = FileUtils.file2String(file);
List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_EXPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (CollectionUtils.isEmpty(dagDataScheduleList)) {
logger.warn("Process definition file content is empty.");
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule, EMPTY_STRING)) {
return result;
}
}
return result;
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
@Transactional
public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result;
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_IMPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename();
int index = processDefinitionName.lastIndexOf(".");
if (index > 0) {
processDefinitionName = processDefinitionName.substring(0, index);
}
processDefinitionName = getNewName(processDefinitionName, IMPORT_SUFFIX);
ProcessDefinition processDefinition;
List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>();
List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>();
final int THRESHOLD_ENTRIES = 10000;
final int THRESHOLD_SIZE = 1000000000;
final double THRESHOLD_RATIO = 10;
int totalEntryArchive = 0;
int totalSizeEntry = 0;
Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Map<String, Long> taskNameToCode = new HashMap<>(16);
Map<String, List<String>> taskNameToUpstream = new HashMap<>(16);
try (
ZipInputStream zIn = new ZipInputStream(file.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinition = new ProcessDefinition(projectCode,
processDefinitionName,
CodeGenerateUtils.getInstance().genCode(),
"",
"[]", null,
0, loginUser.getId(), loginUser.getTenantId());
ZipEntry entry;
while ((entry = zIn.getNextEntry()) != null) {
totalEntryArchive++;
int totalSizeArchive = 0;
if (!entry.isDirectory()) {
StringBuilder sql = new StringBuilder();
String taskName = null;
String datasourceName = null;
List<String> upstreams = Collections.emptyList();
String line;
while ((line = bufferedReader.readLine()) != null) {
int nBytes = line.getBytes(StandardCharsets.UTF_8).length;
totalSizeEntry += nBytes;
totalSizeArchive += nBytes;
long compressionRatio = totalSizeEntry / entry.getCompressedSize();
if (compressionRatio > THRESHOLD_RATIO) {
throw new IllegalStateException(
"Ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack.");
}
int commentIndex = line.indexOf("-- ");
if (commentIndex >= 0) {
int colonIndex = line.indexOf(":", commentIndex);
if (colonIndex > 0) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase();
String value = line.substring(colonIndex + 1).trim();
switch (key) {
case "name":
taskName = value;
line = line.substring(0, commentIndex);
break;
case "upstream":
upstreams = Arrays.stream(value.split(",")).map(String::trim)
.filter(s -> !"".equals(s)).collect(Collectors.toList());
line = line.substring(0, commentIndex);
break;
case "datasource":
datasourceName = value;
line = line.substring(0, commentIndex);
break;
default:
break;
}
}
}
if (!"".equals(line)) {
sql.append(line).append("\n");
}
}
if (taskName == null) {
taskName = entry.getName();
index = taskName.indexOf("/");
if (index > 0) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskName = taskName.substring(index + 1);
}
index = taskName.lastIndexOf(".");
if (index > 0) {
taskName = taskName.substring(0, index);
}
}
DataSource dataSource = dataSourceCache.get(datasourceName);
if (dataSource == null) {
dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser);
}
if (dataSource == null) {
logger.error("Datasource does not found, may be its name is illegal.");
putMsg(result, Status.DATASOURCE_NAME_ILLEGAL);
return result;
}
dataSourceCache.put(datasourceName, dataSource);
TaskDefinitionLog taskDefinition =
buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1));
taskDefinitionList.add(taskDefinition);
taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode());
taskNameToUpstream.put(taskDefinition.getName(), upstreams);
}
if (totalSizeArchive > THRESHOLD_SIZE) {
throw new IllegalStateException(
"the uncompressed data size is too much for the application resource capacity");
}
if (totalEntryArchive > THRESHOLD_ENTRIES) {
throw new IllegalStateException(
"too much entries in this archive, can lead to inodes exhaustion of the system");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
}
} catch (Exception e) {
logger.error("Import process definition error.", e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return result;
}
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) {
List<String> upstreams = taskNameToUpstream.get(entry.getKey());
if (CollectionUtils.isEmpty(upstreams)
|| (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue());
processTaskRelationList.add(processTaskRelation);
continue;
}
for (String upstream : upstreams) {
ProcessTaskRelationLog processTaskRelation =
buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue());
processTaskRelationList.add(processTaskRelation);
}
}
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING);
}
private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) {
ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog();
processTaskRelation.setPreTaskCode(preTaskCode);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPostTaskCode(postTaskCode);
processTaskRelation.setPostTaskVersion(0);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processTaskRelation.setConditionType(ConditionType.NONE);
processTaskRelation.setName("");
return processTaskRelation;
}
private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) {
if (isAdmin(loginUser)) {
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
if (CollectionUtils.isNotEmpty(dataSources)) {
return dataSources.get(0);
}
} else {
return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName);
}
return null;
}
private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource,
String sql) throws CodeGenerateException {
TaskDefinitionLog taskDefinition = new TaskDefinitionLog();
taskDefinition.setName(taskName);
taskDefinition.setFlag(Flag.YES);
SqlParameters sqlParameters = new SqlParameters();
sqlParameters.setType(dataSource.getType().name());
sqlParameters.setDatasource(dataSource.getId());
sqlParameters.setSql(sql.substring(0, sql.length() - 1));
sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal());
sqlParameters.setLocalParams(Collections.emptyList());
taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters));
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
taskDefinition.setTaskType(TASK_TYPE_SQL);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskDefinition.setFailRetryTimes(0);
taskDefinition.setFailRetryInterval(0);
taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE);
taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP);
taskDefinition.setTaskPriority(Priority.MEDIUM);
taskDefinition.setEnvironmentCode(-1);
taskDefinition.setTimeout(0);
taskDefinition.setDelayTime(0);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setVersion(0);
taskDefinition.setResourceIds("");
return taskDefinition;
}
/**
* check and import
*/
protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result,
DagDataSchedule dagDataSchedule, String otherParamsJson) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
String importProcessDefinitionName = getNewName(processDefinitionName, IMPORT_SUFFIX);
Map<String, Object> checkResult =
verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName, 0);
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
} else {
result.putAll(checkResult);
return false;
}
processDefinition.setName(importProcessDefinitionName);
processDefinition.setId(null);
processDefinition.setProjectCode(projectCode);
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error(
"Save process definition error because generate process definition code error, projectCode:{}.",
projectCode, e);
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskDefinitionLog.setOperateTime(now);
try {
long code = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (CodeGenerateException e) {
logger.error("Generate task definition code error, projectCode:{}, processDefinitionCode:{}",
projectCode, processDefinition.getCode(), e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
}
int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
logger.error("Save task definition error, projectCode:{}, processDefinitionCode:{}", projectCode,
processDefinition.getCode());
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
taskRelationLogList.add(processTaskRelationLog);
}
if (StringUtils.isNotEmpty(processDefinition.getLocations())
&& JSONUtils.checkJsonValid(processDefinition.getLocations())) {
ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations());
ArrayNode newArrayNode = JSONUtils.createArrayNode();
for (int i = 0; i < arrayNode.size(); i++) {
ObjectNode newObjectNode = newArrayNode.addObject();
JsonNode jsonNode = arrayNode.get(i);
Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong());
if (Objects.nonNull(taskCode)) {
newObjectNode.put("taskCode", taskCode);
newObjectNode.set("x", jsonNode.get("x"));
newObjectNode.set("y", jsonNode.get("y"));
}
}
processDefinition.setLocations(newArrayNode.toString());
}
processDefinition.setCreateTime(new Date());
processDefinition.setUpdateTime(new Date());
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition,
Lists.newArrayList(), otherParamsJson);
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
putMsg(createDagResult, Status.SUCCESS);
} else {
result.putAll(createDagResult);
logger.error("Import process definition error, projectCode:{}, processDefinitionCode:{}.", projectCode,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinition.getCode());
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
Schedule schedule = dagDataSchedule.getSchedule();
if (null != schedule) {
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now);
int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
logger.error(
"Import process definition error due to save schedule fail, projectCode:{}, processDefinitionCode:{}.",
projectCode, processDefinition.getCode());
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
logger.info("Import process definition complete, projectCode:{}, processDefinitionCode:{}.", projectCode,
processDefinition.getCode());
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
logger.warn("Process definition is null.");
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
logger.warn("Task definition list is null.");
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
logger.warn("Process task relation list is null.");
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition =
processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson,
List<TaskDefinitionLog> taskDefinitionLogsList) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("Process task relation data is null.");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelation> taskRelationList =
JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList);
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("Task node data is empty.");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("Process DAG has cycle.");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
for (TaskNode taskNode : taskNodes) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskNode.getType())
.taskParams(taskNode.getTaskParams())
.dependence(taskNode.getDependence())
.switchResult(taskNode.getSwitchResult())
.build())) {
logger.error("Task node {} parameter invalid.", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e);
}
return result;
}
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.error("Process definitions do not exist, codes:{}.", defineCodeSet);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())
.forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
Set<Long> codesInProject = processDefinitionListInProject.stream()
.map(ProcessDefinition::getCode).collect(Collectors.toSet());
logger.error("Process definitions do not exist in project, projectCode:{}, processDefinitionsCodes:{}.",
processDefinitionListInProject.get(0).getProjectCode(), codesInProject);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList =
processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
/**
* query process definition list by project code
*
* @param projectCode project code
* @return process definition list in the project
*/
@Override
public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) {
Map<String, Object> result = new HashMap<>();
List<DependentSimplifyDefinition> processDefinitions =
processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null);
result.put(Constants.DATA_LIST, processDefinitions);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by process definition code
*
* @param projectCode project code
* @param processDefinitionCode process definition code
* @return task definition list in the process definition
*/
@Override
public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode,
Long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
Set<Long> definitionCodesSet = new HashSet<>();
definitionCodesSet.add(processDefinitionCode);
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper
.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode(
processDefinitions.get(0).getCode(),
processDefinitions.get(0).getVersion());
List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations);
List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) {
DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition();
dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode());
dependentSimplifyDefinition.setName(taskDefinitionLog.getName());
dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion());
taskDefinitionList.add(dependentSimplifyDefinition);
}
result.put(Constants.DATA_LIST, taskDefinitionList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(User loginUser, long projectCode, long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_TREE_VIEW);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance
.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper
.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit < 0) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
return result;
}
if (limit > processInstanceList.size()) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances()
.add(new Instance(processInstance.getId(), processInstance.getName(),
processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime,
processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (!ServerLifeCycleManager.isStopped()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode);
treeViewDto.setType(taskNode.getType());
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(),
Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Long.parseLong(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(),
taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(),
taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* whether the graph has a ring
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
@Override
@Transactional
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode, WORKFLOW_BATCH_COPY);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) {
return result;
}
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* Will be deleted
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result =
checkParams(loginUser, projectCode, codes, targetProjectCode, TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
logger.warn("Project code is same as target project code, projectCode:{}.", projectCode);
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode, String perm) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, perm);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isEmpty(processDefinitionCodes)) {
logger.error("Parameter processDefinitionCodes is empty, projectCode is {}.", projectCode);
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult =
projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode, perm);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result;
}
protected void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes =
processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode =
definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(),
processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList =
processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
logger.info("Copy process definition...");
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) {
logger.error("Task types {} do not support copy.", taskDefinitionLog.getTaskType());
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType());
return;
}
try {
long taskCode = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) {
logger.error("Generate task definition code error, projectCode:{}.", targetProjectCode, e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
taskDefinitionLog.setProjectCode(targetProjectCode);
taskDefinitionLog.setVersion(0);
taskDefinitionLog.setName(taskDefinitionLog.getName());
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (processTaskRelationLog.getPreTaskCode() > 0) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (processTaskRelationLog.getPostTaskCode() > 0) {
processTaskRelationLog
.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
}
}
final long oldProcessDefinitionCode = processDefinition.getCode();
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error("Generate process definition code error, projectCode:{}.", targetProjectCode, e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(null);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(getNewName(processDefinition.getName(), COPY_SUFFIX));
final Date date = new Date();
processDefinition.setCreateTime(date);
processDefinition.setUpdateTime(date);
processDefinition.setReleaseState(ReleaseState.OFFLINE);
if (StringUtils.isNotBlank(processDefinition.getLocations())) {
ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations());
for (int i = 0; i < jsonNodes.size(); i++) {
ObjectNode node = (ObjectNode) jsonNodes.path(i);
node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong()));
jsonNodes.set(i, node);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(oldProcessDefinitionCode);
if (scheduleObj != null) {
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setCreateTime(date);
scheduleObj.setUpdateTime(date);
int insertResult = scheduleMapper.insert(scheduleObj);
if (insertResult != 1) {
logger.error("Schedule create error, processDefinitionCode:{}.", processDefinition.getCode());
putMsg(result, Status.CREATE_SCHEDULE_ERROR);
throw new ServiceException(Status.CREATE_SCHEDULE_ERROR);
}
}
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs,
otherParamsJson));
} catch (Exception e) {
logger.error("Copy process definition error, processDefinitionCode from {} to {}.",
oldProcessDefinitionCode, processDefinition.getCode(), e);
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
logger.info("Move process definition...");
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null,
Lists.newArrayList(), otherParamsJson));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
} catch (Exception e) {
logger.error("Move process definition error, processDefinitionCode:{}.",
processDefinition.getCode(), e);
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* get new Task name or Process name when copy or import operate
* @param originalName Task or Process original name
* @param suffix "_copy_" or "_import_"
* @return new name
*/
public String getNewName(String originalName, String suffix) {
StringBuilder newName = new StringBuilder();
String regex = String.format(".*%s\\d{17}$", suffix);
if (originalName.matches(regex)) {
return newName.append(originalName, 0, originalName.lastIndexOf(suffix))
.append(suffix)
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
return newName.append(originalName)
.append(suffix)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code,
int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_SWITCH_TO_THIS_VERSION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
logger.error(
"Switch process definition error because it does not exist, projectCode:{}, processDefinitionCode:{}.",
projectCode, code);
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
logger.error(
"Switch process definition error because version does not exist, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR,
processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
logger.error(
"Switch process definition version error, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
logger.info("Switch process definition version complete, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
String failedProcess = String.join(",", failedProcessList);
if (isCopy) {
logger.error(
"Copy process definition error, srcProjectCode:{}, targetProjectCode:{}, failedProcessList:{}.",
srcProjectCode, targetProjectCode, failedProcess);
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, failedProcess);
} else {
logger.error(
"Move process definition error, srcProjectCode:{}, targetProjectCode:{}, failedProcessList:{}.",
srcProjectCode, targetProjectCode, failedProcess);
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, failedProcess);
}
} else {
logger.info("Batch {} process definition complete, srcProjectCode:{}, targetProjectCode:{}.",
isCopy ? "copy" : "move", srcProjectCode, targetProjectCode);
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize,
long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_LIST);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinitionLog> processDefinitionVersionsPaging =
processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete one certain process definition by version number and process definition code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param code process definition code
* @param version version number
* @return delete result code
*/
@Override
@Transactional
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code,
int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
if (processDefinition.getVersion() == version) {
logger.warn(
"Process definition can not be deleted due to version is being used, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version);
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version);
if (deleteLog == 0 || deleteRelationLog == 0) {
logger.error(
"Delete process definition version error, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
deleteOtherRelation(project, result, processDefinition);
logger.info(
"Delete process definition version complete, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
@Override
@Transactional
public Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.",
definition.getName(), definition.getCode());
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
logger.error("Generate process definition code error, projectCode:{}.", projectCode, e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition =
new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, "", timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
result = createEmptyDagDefine(loginUser, processDefinition);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
logger.error("Create empty process definition error.");
return result;
}
if (StringUtils.isBlank(scheduleJson)) {
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
Map<String, Object> scheduleResult = createDagSchedule(loginUser, processDefinition, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> createEmptyDagDefine(User loginUser, ProcessDefinition processDefinition) {
Map<String, Object> result = new HashMap<>();
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
logger.error("Save process definition error, processDefinitionCode:{}.", processDefinition.getCode());
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
return result;
}
protected Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (scheduleObj == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Date now = new Date();
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
if (DateUtils.differSec(scheduleObj.getStartTime(), scheduleObj.getEndTime()) == 0) {
logger.warn("The schedule start time must not be the same as the end, processDefinitionCode:{}.",
processDefinition.getCode());
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) {
logger.error("CronExpression verify failure, cron:{}.", scheduleObj.getCrontab());
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleObj.getCrontab());
return result;
}
scheduleObj
.setWarningType(scheduleObj.getWarningType() == null ? WarningType.NONE : scheduleObj.getWarningType());
scheduleObj.setWarningGroupId(scheduleObj.getWarningGroupId() == 0 ? 1 : scheduleObj.getWarningGroupId());
scheduleObj.setFailureStrategy(
scheduleObj.getFailureStrategy() == null ? FailureStrategy.CONTINUE : scheduleObj.getFailureStrategy());
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setProcessInstancePriority(scheduleObj.getProcessInstancePriority() == null ? Priority.MEDIUM
: scheduleObj.getProcessInstancePriority());
scheduleObj.setWorkerGroup(scheduleObj.getWorkerGroup() == null ? "default" : scheduleObj.getWorkerGroup());
scheduleObj
.setEnvironmentCode(scheduleObj.getEnvironmentCode() == null ? -1 : scheduleObj.getEnvironmentCode());
scheduleMapper.insert(scheduleObj);
putMsg(result, Status.SUCCESS);
result.put("scheduleId", scheduleObj.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
/**
* update process definition basic info
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param otherParamsJson otherParamsJson handle other params
* @param executionType executionType
* @return update result code
*/
@Override
@Transactional
public Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
String otherParamsJson,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
logger.warn("Process definition is not allowed to be modified due to {}, processDefinitionCode:{}.",
ReleaseState.ONLINE.getDescp(), processDefinition.getCode());
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.",
definition.getName(), definition.getCode());
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy =
JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, "", timeout, tenantId);
processDefinition.setExecutionType(executionType);
List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper
.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
result = updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy,
Lists.newArrayList(), otherParamsJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
logger.error("Update process definition basic info error.");
return result;
}
if (StringUtils.isBlank(scheduleJson)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
Map<String, Object> scheduleResult = updateDagSchedule(loginUser, projectCode, code, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
private void updateWorkflowValid(User user, ProcessDefinition oldProcessDefinition,
ProcessDefinition newProcessDefinition) {
if (oldProcessDefinition.getReleaseState() == ReleaseState.ONLINE) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, oldProcessDefinition.getName());
}
Project project = projectMapper.queryByCode(oldProcessDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(user, project, WORKFLOW_UPDATE);
if (checkDescriptionLength(newProcessDefinition.getDescription())) {
throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);
}
if (!oldProcessDefinition.getName().equals(newProcessDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper
.verifyByDefineName(newProcessDefinition.getProjectCode(), newProcessDefinition.getName());
if (definition != null) {
throw new ServiceException(Status.PROCESS_DEFINITION_NAME_EXIST, newProcessDefinition.getName());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
}
/**
* update single resource workflow
*
* @param loginUser login user
* @param workflowCode workflow resource code want to update
* @param workflowUpdateRequest workflow update resource object
* @return Process definition
*/
@Override
@Transactional
public ProcessDefinition updateSingleProcessDefinition(User loginUser,
long workflowCode,
WorkflowUpdateRequest workflowUpdateRequest) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(workflowCode);
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, workflowCode);
}
ProcessDefinition processDefinitionUpdate = workflowUpdateRequest.mergeIntoProcessDefinition(processDefinition);
this.updateWorkflowValid(loginUser, processDefinition, processDefinitionUpdate);
if (processDefinitionUpdate.getTenantCode() != null) {
Tenant tenant = tenantMapper.queryByTenantCode(processDefinitionUpdate.getTenantCode());
if (tenant == null) {
throw new ServiceException(Status.TENANT_NOT_EXIST);
}
processDefinitionUpdate.setTenantId(tenant.getId());
}
int update = processDefinitionMapper.updateById(processDefinitionUpdate);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (update <= 0) {
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
this.syncObj2Log(loginUser, processDefinition);
return processDefinition;
}
protected Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule schedule = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (schedule == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
FailureStrategy failureStrategy =
schedule.getFailureStrategy() == null ? FailureStrategy.CONTINUE : schedule.getFailureStrategy();
WarningType warningType = schedule.getWarningType() == null ? WarningType.NONE : schedule.getWarningType();
Priority processInstancePriority =
schedule.getProcessInstancePriority() == null ? Priority.MEDIUM : schedule.getProcessInstancePriority();
int warningGroupId = schedule.getWarningGroupId() == 0 ? 1 : schedule.getWarningGroupId();
String workerGroup = schedule.getWorkerGroup() == null ? "default" : schedule.getWorkerGroup();
long environmentCode = schedule.getEnvironmentCode() == null ? -1 : schedule.getEnvironmentCode();
ScheduleParam param = new ScheduleParam();
param.setStartTime(schedule.getStartTime());
param.setEndTime(schedule.getEndTime());
param.setCrontab(schedule.getCrontab());
param.setTimezoneId(schedule.getTimezoneId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return schedulerService.updateScheduleByProcessDefinitionCode(
loginUser,
projectCode,
processDefinitionCode,
JSONUtils.toJsonString(param),
warningType,
warningGroupId,
failureStrategy,
processInstancePriority,
workerGroup,
environmentCode);
}
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState
* @return update result code
*/
@Transactional
@Override
public Map<String, Object> releaseWorkflowAndSchedule(User loginUser, long projectCode, long code,
ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj == null) {
logger.error("Schedule cron does not exist, processDefinitionCode:{}.", code);
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, "processDefinitionCode:" + code);
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList =
processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) {
logger.warn("Process definition has no task relation, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
if (updateProcess > 0) {
logger.info("Set schedule offline, projectCode:{}, processDefinitionCode:{}, scheduleId:{}.",
projectCode, code, scheduleObj.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
logger.error(
"Set schedule offline error, projectCode:{}, processDefinitionCode:{}, scheduleId:{}",
projectCode, code, scheduleObj.getId());
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), scheduleObj.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* save other relation
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,274 |
[Bug] [Workflow Definition] copy workflow error
|
### 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
press copy workflow button get an error. here's log

`[ERROR] 2022-10-09 06:18:41.012 +0000 org.apache.dolphinscheduler.api.exceptions.ApiExceptionHandler:[53] - 复制工作流错误
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
### The error may exist in org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java (best guess)
### The error may involve org.apache.dolphinscheduler.dao.mapper.ScheduleMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO t_ds_schedules ( id, process_definition_code, start_time, end_time, timezone_id, crontab, failure_strategy, warning_type, create_time, update_time, user_id, release_state, warning_group_id, process_instance_priority, worker_group, environment_code ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
; ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "t_ds_schedules_pkey"
Detail: Key (id)=(2) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy138.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)`
### What you expected to happen
successfully copy workflow
### How to reproduce
just press copy workflow
### Anything else
user pg as database
### Version
3.1.x
### Are you willing to submit PR?
- [ ] 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/12274
|
https://github.com/apache/dolphinscheduler/pull/12280
|
98a8b5383edf695811b64f6d871e8783e4a60003
|
18ef0a66cb91d9dfe6406f8ade6cfb2cff36492e
| 2022-10-09T06:23:55Z |
java
| 2022-10-11T02:53:25Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result,
String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
@Override
public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) {
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.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.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import org.apache.dolphinscheduler.api.dto.gantt.GanttDto;
import org.apache.dolphinscheduler.api.dto.gantt.Task;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.LoggerService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ResponseTaskLog;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE;
import static org.apache.dolphinscheduler.api.enums.Status.PROCESS_INSTANCE_NOT_EXIST;
import static org.apache.dolphinscheduler.api.enums.Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR;
import static org.apache.dolphinscheduler.common.Constants.DATA_LIST;
import static org.apache.dolphinscheduler.common.Constants.DEPENDENT_SPLIT;
import static org.apache.dolphinscheduler.common.Constants.GLOBAL_PARAMS;
import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS;
import static org.apache.dolphinscheduler.common.Constants.PROCESS_INSTANCE_STATE;
import static org.apache.dolphinscheduler.common.Constants.TASK_LIST;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SUB_PROCESS;
/**
* process instance service impl
*/
@Service
public class ProcessInstanceServiceImpl extends BaseServiceImpl implements ProcessInstanceService {
private static final Logger logger = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class);
public static final String TASK_TYPE = "taskType";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
@Autowired
ProjectMapper projectMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
@Autowired
ProjectService projectService;
@Autowired
ProcessService processService;
@Autowired
ProcessInstanceMapper processInstanceMapper;
@Autowired
ProcessInstanceDao processInstanceDao;
@Autowired
ProcessDefinitionMapper processDefineMapper;
@Autowired
ProcessDefinitionService processDefinitionService;
@Autowired
ExecutorService execService;
@Autowired
TaskInstanceMapper taskInstanceMapper;
@Autowired
LoggerService loggerService;
@Autowired
ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
UsersService usersService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskPluginManager taskPluginManager;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private CuringParamsService curingGlobalParamsService;
/**
* return top n SUCCESS process instance order by running time which started between startTime and endTime
*/
@Override
public Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser, long projectCode, int size,
String startTime, String endTime) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (0 > size) {
putMsg(result, Status.NEGTIVE_SIZE_NUMBER_ERROR, size);
return result;
}
if (Objects.isNull(startTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.START_TIME);
return result;
}
Date start = DateUtils.stringToDate(startTime);
if (Objects.isNull(endTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.END_TIME);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
Date end = DateUtils.stringToDate(endTime);
if (start == null || end == null) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.START_END_DATE);
return result;
}
if (start.getTime() > end.getTime()) {
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR, startTime, endTime);
return result;
}
List<ProcessInstance> processInstances = processInstanceMapper.queryTopNProcessInstance(size, start, end,
WorkflowExecutionStatus.SUCCESS, projectCode);
result.put(DATA_LIST, processInstances);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process instance by id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
* @return process instance detail
*/
@Override
public Map<String, Object> queryProcessInstanceById(User loginUser, long projectCode, Integer processId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId));
ProcessDefinition processDefinition =
processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}.", projectCode);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
} else {
processInstance.setLocations(processDefinition.getLocations());
processInstance.setDagData(processService.genDagData(processDefinition));
result.put(DATA_LIST, processInstance);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* paging query process instance list, filtering according to project, process definition, time range, keyword, process status
*
* @param loginUser login user
* @param projectCode project code
* @param processDefineCode process definition code
* @param pageNo page number
* @param pageSize page size
* @param searchVal search value
* @param stateType state type
* @param host host
* @param startDate start time
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @param endDate end time
* @param otherParamsJson otherParamsJson handle other params
* @return process instance list
*/
@Override
public Result queryProcessInstanceList(User loginUser, long projectCode, long processDefineCode, String startDate,
String endDate, String searchVal, String executorName,
WorkflowExecutionStatus stateType, String host, String otherParamsJson,
Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
int[] statusArray = null;
if (stateType != null) {
statusArray = new int[]{stateType.getCode()};
}
Map<String, Object> checkAndParseDateResult = checkAndParseDateParameters(startDate, endDate);
resultEnum = (Status) checkAndParseDateResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
Date start = (Date) checkAndParseDateResult.get(Constants.START_TIME);
Date end = (Date) checkAndParseDateResult.get(Constants.END_TIME);
Page<ProcessInstance> page = new Page<>(pageNo, pageSize);
PageInfo<ProcessInstance> pageInfo = new PageInfo<>(pageNo, pageSize);
int executorId = usersService.getUserIdByName(executorName);
IPage<ProcessInstance> processInstanceList = processInstanceMapper.queryProcessInstanceListPaging(page,
project.getCode(), processDefineCode, searchVal, executorId, statusArray, host, start, end);
List<ProcessInstance> processInstances = processInstanceList.getRecords();
List<Integer> userIds = Collections.emptyList();
if (CollectionUtils.isNotEmpty(processInstances)) {
userIds = processInstances.stream().map(ProcessInstance::getExecutorId).collect(Collectors.toList());
}
List<User> users = usersService.queryUser(userIds);
Map<Integer, User> idToUserMap = Collections.emptyMap();
if (CollectionUtils.isNotEmpty(users)) {
idToUserMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
}
for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
User executor = idToUserMap.get(processInstance.getExecutorId());
if (null != executor) {
processInstance.setExecutorName(executor.getUserName());
}
}
pageInfo.setTotal((int) processInstanceList.getTotal());
pageInfo.setTotalList(processInstances);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
/**
* query task list by process instance id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
* @return task list for the process instance
* @throws IOException io exception
*/
@Override
public Map<String, Object> queryTaskListByProcessId(User loginUser, long projectCode,
Integer processId) throws IOException {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processId));
ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionId:{}.", projectCode, processId);
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processId);
return result;
}
List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processId, processInstance.getTestFlag());
addDependResultForTaskList(taskInstanceList);
Map<String, Object> resultMap = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
resultMap.put(PROCESS_INSTANCE_STATE, processInstance.getState().toString());
resultMap.put(TASK_LIST, taskInstanceList);
result.put(DATA_LIST, resultMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* add dependent result for dependent task
*/
private void addDependResultForTaskList(List<TaskInstance> taskInstanceList) throws IOException {
for (TaskInstance taskInstance : taskInstanceList) {
if (TASK_TYPE_DEPENDENT.equalsIgnoreCase(taskInstance.getTaskType())) {
logger.info("DEPENDENT type task instance need to set dependent result, taskCode:{}, taskInstanceId:{}", taskInstance.getTaskCode(), taskInstance.getId());
Result<ResponseTaskLog> logResult = loggerService.queryLog(
taskInstance.getId(), Constants.LOG_QUERY_SKIP_LINE_NUMBER, Constants.LOG_QUERY_LIMIT);
if (logResult.getCode() == Status.SUCCESS.ordinal()) {
String log = logResult.getData().getMessage();
Map<String, DependResult> resultMap = parseLogForDependentResult(log);
taskInstance.setDependentResult(JSONUtils.toJsonString(resultMap));
}
}
}
}
@Override
public Map<String, DependResult> parseLogForDependentResult(String log) throws IOException {
Map<String, DependResult> resultMap = new HashMap<>();
if (StringUtils.isEmpty(log)) {
logger.warn("Log content is empty.");
return resultMap;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(log.getBytes(
StandardCharsets.UTF_8)), StandardCharsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
if (line.contains(DEPENDENT_SPLIT)) {
String[] tmpStringArray = line.split(":\\|\\|");
if (tmpStringArray.length != 2) {
continue;
}
String dependResultString = tmpStringArray[1];
String[] dependStringArray = dependResultString.split(",");
if (dependStringArray.length != 2) {
continue;
}
String key = dependStringArray[0].trim();
DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim());
resultMap.put(key, dependResult);
}
}
return resultMap;
}
/**
* query sub process instance detail info by task id
*
* @param loginUser login user
* @param projectCode project code
* @param taskId task id
* @return sub process instance detail
*/
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
public Map<String, Object> querySubProcessInstanceByTaskId(User loginUser, long projectCode, Integer taskId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskInstance taskInstance = processService.findTaskInstanceById(taskId);
if (taskInstance == null) {
logger.error("Task instance does not exist, projectCode:{}, taskInstanceId{}.", projectCode, taskId);
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskInstance.getTaskCode());
if (taskDefinition != null && projectCode != taskDefinition.getProjectCode()) {
logger.error("Task definition does not exist, projectCode:{}, taskDefinitionCode:{}.", projectCode, taskInstance.getTaskCode());
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
if (!taskInstance.isSubProcess()) {
logger.warn("Task instance is not {} type instance, projectCode:{}, taskInstanceId:{}.", TASK_TYPE_SUB_PROCESS, projectCode, taskId);
putMsg(result, Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, taskInstance.getName());
return result;
}
ProcessInstance subWorkflowInstance = processService.findSubProcessInstance(
taskInstance.getProcessInstanceId(), taskInstance.getId());
if (subWorkflowInstance == null) {
logger.error("SubProcess instance does not exist, projectCode:{}, taskInstanceId:{}.", projectCode, taskInstance.getId());
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST, taskId);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
return result;
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.SUBPROCESS_INSTANCE_ID, subWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance
*
* @param loginUser login user
* @param projectCode project code
* @param taskRelationJson process task relation json
* @param taskDefinitionJson taskDefinitionJson
* @param processInstanceId process instance id
* @param scheduleTime schedule time
* @param syncDefine sync define
* @param globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @return update result code
*/
@Transactional
@Override
public Map<String, Object> updateProcessInstance(User loginUser, long projectCode, Integer processInstanceId,
String taskRelationJson,
String taskDefinitionJson, String scheduleTime, Boolean syncDefine,
String globalParams,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
String locations, int timeout, String tenantCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
ProcessDefinition processDefinition0 = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode, processInstance.getProcessDefinitionCode());
putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
if (!processInstance.getState().isFinished()) {
logger.warn("Process Instance state is {} so can not update process instance, processInstanceId:{}.", processInstance.getState().getDesc(), processInstanceId);
putMsg(result, PROCESS_INSTANCE_STATE_OPERATION_ERROR,
processInstance.getName(), processInstance.getState().toString(), "update");
return result;
}
Map<String, String> commandParamMap = JSONUtils.toMap(processInstance.getCommandParam());
String timezoneId = null;
if (commandParamMap == null || StringUtils.isBlank(commandParamMap.get(Constants.SCHEDULE_TIMEZONE))) {
timezoneId = loginUser.getTimeZone();
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
timezoneId = commandParamMap.get(Constants.SCHEDULE_TIMEZONE);
}
setProcessInstance(processInstance, tenantCode, scheduleTime, globalParams, timeout, timezoneId);
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
if (taskDefinitionLogs.isEmpty()) {
logger.warn("Parameter taskDefinitionJson is empty");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType())
.taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
logger.error("Task parameters are invalid, taskDefinitionName:{}.", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, syncDefine);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
logger.error("Update task definition error, projectCode:{}, processInstanceId:{}", projectCode, processInstanceId);
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
List<ProcessTaskRelationLog> taskRelationList =
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
result = processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
processDefinition.set(projectCode, processDefinition.getName(), processDefinition.getDescription(),
globalParams, locations, timeout, tenantId);
processDefinition.setUpdateTime(new Date());
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, syncDefine, Boolean.FALSE);
if (insertVersion == 0) {
logger.error("Update process definition error, projectCode:{}, processDefinitionName:{}.", projectCode, processDefinition.getName());
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
} else
logger.info("Update process definition complete, projectCode:{}, processDefinitionName:{}.", projectCode, processDefinition.getName());
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, syncDefine);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("Update task relations complete, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}.",
projectCode, processDefinition.getCode(), insertVersion);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
logger.info("Update task relations error, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}.",
projectCode, processDefinition.getCode(), insertVersion);
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
processInstance.setProcessDefinitionVersion(insertVersion);
int update = processInstanceDao.updateProcessInstance(processInstance);
if (update == 0) {
logger.error("Update process instance version error, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}",
projectCode, processDefinition.getCode(), insertVersion);
putMsg(result, Status.UPDATE_PROCESS_INSTANCE_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_INSTANCE_ERROR);
}
logger.info("Update process instance complete, projectCode:{}, processDefinitionCode:{}, processDefinitionVersion:{}, processInstanceId:{}",
projectCode, processDefinition.getCode(), insertVersion, processInstanceId);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance attributes
*/
private void setProcessInstance(ProcessInstance processInstance, String tenantCode, String scheduleTime,
String globalParams, int timeout, String timezone) {
Date schedule = processInstance.getScheduleTime();
if (scheduleTime != null) {
schedule = DateUtils.stringToDate(scheduleTime);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
processInstance.setScheduleTime(schedule);
List<Property> globalParamList = JSONUtils.toList(globalParams, Property.class);
Map<String, String> globalParamMap =
globalParamList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
globalParams = curingGlobalParamsService.curingGlobalParams(processInstance.getId(), globalParamMap,
globalParamList, processInstance.getCmdTypeIfComplement(), schedule, timezone);
processInstance.setTimeout(timeout);
processInstance.setTenantCode(tenantCode);
processInstance.setGlobalParams(globalParams);
}
/**
* query parent process instance detail info by sub process instance id
*
* @param loginUser login user
* @param projectCode project code
* @param subId sub process id
* @return parent instance detail
*/
@Override
public Map<String, Object> queryParentInstanceBySubId(User loginUser, long projectCode, Integer subId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance subInstance = processService.findProcessInstanceDetailById(subId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, subId));
if (subInstance.getIsSubProcess() == Flag.NO) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
logger.warn("Process instance is not sub process instance type, processInstanceId:{}, processInstanceName:{}.", subId, subInstance.getName());
putMsg(result, Status.PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE, subInstance.getName());
return result;
}
ProcessInstance parentWorkflowInstance = processService.findParentProcessInstance(subId);
if (parentWorkflowInstance == null) {
logger.error("Parent process instance does not exist, projectCode:{}, subProcessInstanceId:{}.", projectCode, subId);
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST);
return result;
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.PARENT_WORKFLOW_INSTANCE, parentWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete process instance by id, at the same time,delete task instance and their mapping relation data
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @return delete result code
*/
@Override
@Transactional
public Map<String, Object> deleteProcessInstanceById(User loginUser, long projectCode, Integer processInstanceId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId)
.orElseThrow(() -> new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId));
if (!processInstance.getState().isFinished()) {
logger.warn("Process Instance state is {} so can not delete process instance, processInstanceId:{}.",
processInstance.getState().getDesc(), processInstanceId);
throw new ServiceException(PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), processInstance.getState(), "delete");
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, projectCode:{}, ProcessDefinitionCode:{}.",
projectCode, processInstance.getProcessDefinitionCode());
throw new ServiceException(PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
}
try {
processService.removeTaskLogFile(processInstanceId);
} catch (Exception ) {
logger.warn("Remove task log file exception, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
}
int delete = processService.deleteWorkProcessInstanceById(processInstanceId);
processService.deleteAllSubWorkProcessByParentId(processInstanceId);
processService.deleteWorkProcessMapByParentId(processInstanceId);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,669 |
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
|
### 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 the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance
was run for the first time or re-run.
But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong.
Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**.
Please check the following code:
`for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
...
}`
### What you expected to happen
When the workflow instanceis running, the duration should be null,
### How to reproduce
Step 1. Create a workflow instance and run it.
Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing.
### Anything else
Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**.
### Version
dev
### 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/11669
|
https://github.com/apache/dolphinscheduler/pull/12264
|
0e1c8d81530ad530779469598f03410ceb9b067b
|
17cd644506872c1b8e3f9ddf657371580c35e4e6
| 2022-08-26T13:10:47Z |
java
| 2022-10-13T01:50:31Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
processService.deleteWorkTaskInstanceByProcessInstanceId(processInstanceId);
if (delete > 0) {
logger.info("Delete process instance complete, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
putMsg(result, Status.SUCCESS);
} else {
logger.error("Delete process instance error, projectCode:{}, ProcessDefinitionCode{}, processInstanceId:{}.",
projectCode, processInstance.getProcessDefinitionCode(), processInstanceId);
putMsg(result, Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
}
return result;
}
/**
* view process instance variables
*
* @param projectCode project code
* @param processInstanceId process instance id
* @return variables data
*/
@Override
public Map<String, Object> viewVariables(long projectCode, Integer processInstanceId) {
Map<String, Object> result = new HashMap<>();
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if (processInstance == null) {
logger.error("Process instance does not exist, projectCode:{}, processInstanceId:{}.", projectCode, processInstanceId);
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
ProcessDefinition processDefinition =
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.