status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
private ProcessTaskRelationMapper processTaskRelationMapper; /** * save schedule * * @param loginUser login user * @param projectCode project name * @param processDefineCode process definition code * @param schedule scheduler * @param warningType warning type * @param warningGroupId warning group id * @param failureStrategy failure strategy * @param processInstancePriority process instance priority * @param workerGroup worker group * @param environmentCode environment code * @return create result code */ @Override @Transactional public Map<String, Object> insertSchedule(User loginUser, long projectCode, long processDefineCode, String schedule, WarningType warningType, int warningGroupId, FailureStrategy failureStrategy, Priority processInstancePriority, String workerGroup, Long environmentCode) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result, null); if (!hasProjectAndPerm) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); result = executorService.checkProcessDefinitionValid(projectCode, processDefinition, processDefineCode, processDefinition.getVersion()); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } Schedule scheduleObj = new Schedule(); Date now = new Date(); scheduleObj.setProjectName(project.getName()); scheduleObj.setProcessDefinitionCode(processDefineCode); scheduleObj.setProcessDefinitionName(processDefinition.getName()); ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class); if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) { logger.warn("The start time must not be the same as the end"); putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME); return result; } if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) { logger.warn("The start time must smaller than end time"); putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR); return result; } scheduleObj.setStartTime(scheduleParam.getStartTime()); scheduleObj.setEndTime(scheduleParam.getEndTime());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) { logger.error("{} verify failure", scheduleParam.getCrontab()); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleParam.getCrontab()); return result; } scheduleObj.setCrontab(scheduleParam.getCrontab()); scheduleObj.setTimezoneId(scheduleParam.getTimezoneId()); scheduleObj.setWarningType(warningType); scheduleObj.setWarningGroupId(warningGroupId); scheduleObj.setFailureStrategy(failureStrategy); scheduleObj.setCreateTime(now); scheduleObj.setUpdateTime(now); scheduleObj.setUserId(loginUser.getId()); scheduleObj.setUserName(loginUser.getUserName()); scheduleObj.setReleaseState(ReleaseState.OFFLINE); scheduleObj.setProcessInstancePriority(processInstancePriority); scheduleObj.setWorkerGroup(workerGroup); scheduleObj.setEnvironmentCode(environmentCode); scheduleMapper.insert(scheduleObj); /** * updateProcessInstance receivers and cc by process definition id */ processDefinition.setWarningGroupId(warningGroupId); processDefinitionMapper.updateById(processDefinition); result.put(Constants.DATA_LIST, scheduleMapper.selectById(scheduleObj.getId())); putMsg(result, Status.SUCCESS); result.put("scheduleId", scheduleObj.getId()); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
/** * updateProcessInstance schedule * * @param loginUser login user * @param projectCode project code * @param id scheduler id * @param scheduleExpression scheduler * @param warningType warning type * @param warningGroupId warning group id * @param failureStrategy failure strategy * @param workerGroup worker group * @param environmentCode environment code * @param processInstancePriority process instance priority * @return update result code */ @Override @Transactional public Map<String, Object> updateSchedule(User loginUser, long projectCode, Integer id, String scheduleExpression, WarningType warningType, int warningGroupId, FailureStrategy failureStrategy, Priority processInstancePriority, String workerGroup, Long environmentCode) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result, null); if (!hasProjectAndPerm) { return result; } Schedule schedule = scheduleMapper.selectById(id); if (schedule == null) { putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, id); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode()); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(schedule.getProcessDefinitionCode())); return result; } updateSchedule(result, schedule, processDefinition, scheduleExpression, warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode); return result; } /** * set schedule online or offline * * @param loginUser login user * @param projectCode project code * @param id scheduler id * @param scheduleStatus schedule status * @return publish result code */ @Override @Transactional public Map<String, Object> setScheduleState(User loginUser,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
long projectCode, Integer id, ReleaseState scheduleStatus) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result, null); if (!hasProjectAndPerm) { return result; } Schedule scheduleObj = scheduleMapper.selectById(id); if (scheduleObj == null) { putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, id); return result; } if (scheduleObj.getReleaseState() == scheduleStatus) { logger.info("schedule release is already {},needn't to change schedule id: {} from {} to {}", scheduleObj.getReleaseState(), scheduleObj.getId(), scheduleObj.getReleaseState(), scheduleStatus); putMsg(result, Status.SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE, scheduleStatus); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(scheduleObj.getProcessDefinitionCode()); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(scheduleObj.getProcessDefinitionCode())); return result; } List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, scheduleObj.getProcessDefinitionCode()); if (processTaskRelations.isEmpty()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } if (scheduleStatus == ReleaseState.ONLINE) { if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { logger.info("not release process definition id: {} , name : {}", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefinition.getName()); return result; } List<Long> subProcessDefineCodes = new ArrayList<>(); processService.recurseFindSubProcess(processDefinition.getCode(), subProcessDefineCodes); if (!subProcessDefineCodes.isEmpty()) { List<ProcessDefinition> subProcessDefinitionList = processDefinitionMapper.queryByCodes(subProcessDefineCodes); if (subProcessDefinitionList != null && !subProcessDefinitionList.isEmpty()) { for (ProcessDefinition subProcessDefinition : subProcessDefinitionList) { /** * if there is no online process, exit directly */ if (subProcessDefinition.getReleaseState() != ReleaseState.ONLINE) { logger.info("not release process definition id: {} , name : {}", subProcessDefinition.getId(), subProcessDefinition.getName()); putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(subProcessDefinition.getId())); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
} } } List<Server> masterServers = monitorService.getServerListFromRegistry(true); if (masterServers.isEmpty()) { putMsg(result, Status.MASTER_NOT_EXISTS); return result; } scheduleObj.setReleaseState(scheduleStatus); scheduleMapper.updateById(scheduleObj); try { switch (scheduleStatus) { case ONLINE: logger.info("Call master client set schedule online, project id: {}, flow id: {},host: {}", project.getId(), processDefinition.getId(), masterServers); setSchedule(project.getId(), scheduleObj); break; case OFFLINE: logger.info("Call master client set schedule offline, project id: {}, flow id: {},host: {}", project.getId(), processDefinition.getId(), masterServers); deleteSchedule(project.getId(), id); break; default: putMsg(result, Status.SCHEDULE_STATUS_UNKNOWN, scheduleStatus.toString()); return result; } } catch (Exception e) { result.put(Constants.MSG, scheduleStatus == ReleaseState.ONLINE ? "set online failure" : "set offline failure"); throw new ServiceException(result.get(Constants.MSG).toString(), e); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } /** * query schedule * * @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 * @return schedule list page */ @Override public Result querySchedule(User loginUser, long projectCode, long processDefineCode, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result); if (!hasProjectAndPerm) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); return result; } Page<Schedule> page = new Page<>(pageNo, pageSize);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineCodePaging(page, processDefineCode, searchVal); List<ScheduleVo> scheduleList = new ArrayList<>(); for (Schedule schedule : scheduleIPage.getRecords()) { scheduleList.add(new ScheduleVo(schedule)); } PageInfo<ScheduleVo> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) scheduleIPage.getTotal()); pageInfo.setTotalList(scheduleList); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query schedule list * * @param loginUser login user * @param projectCode project code * @return schedule list */ @Override public Map<String, Object> queryScheduleList(User loginUser, long projectCode) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = projectService.hasProjectAndPerm(loginUser, project, result, null); if (!hasProjectAndPerm) { return result; } List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(project.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
List<ScheduleVo> scheduleList = new ArrayList<>(); for (Schedule schedule : schedules) { scheduleList.add(new ScheduleVo(schedule)); } result.put(Constants.DATA_LIST, scheduleList); putMsg(result, Status.SUCCESS); return result; } public void setSchedule(int projectId, Schedule schedule) { logger.info("set schedule, project id: {}, scheduleId: {}", projectId, schedule.getId()); schedulerApi.insertOrUpdateScheduleTask(projectId, schedule); } /** * delete schedule * * @param projectId project id * @param scheduleId schedule id * @throws RuntimeException runtime exception */ @Override public void deleteSchedule(int projectId, int scheduleId) { logger.info("delete schedules of project id:{}, schedule id:{}", projectId, scheduleId); schedulerApi.deleteScheduleTask(projectId, scheduleId); } /** * check valid * * @param result result * @param bool bool * @param status status
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
* @return check result code */ private boolean checkValid(Map<String, Object> result, boolean bool, Status status) { if (bool) { putMsg(result, status); return true; } return false; } /** * delete schedule by id * * @param loginUser login user * @param projectCode project code * @param scheduleId scheule id * @return delete result code */ @Override public Map<String, Object> deleteScheduleById(User loginUser, long projectCode, Integer scheduleId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode, null); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } Schedule schedule = scheduleMapper.selectById(scheduleId); if (schedule == null) { putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, scheduleId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
return result; } if (loginUser.getId() != schedule.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (schedule.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId()); return result; } int delete = scheduleMapper.deleteById(scheduleId); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); } return result; } /** * preview schedule * * @param loginUser login user * @param schedule schedule expression * @return the next five fire time */ @Override public Map<String, Object> previewSchedule(User loginUser, String schedule) { Map<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
Cron cron; ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class); ZoneId zoneId = TimeZone.getTimeZone(scheduleParam.getTimezoneId()).toZoneId(); ZonedDateTime now = ZonedDateTime.now(zoneId); ZonedDateTime startTime = ZonedDateTime.ofInstant(scheduleParam.getStartTime().toInstant(), zoneId); ZonedDateTime endTime = ZonedDateTime.ofInstant(scheduleParam.getEndTime().toInstant(), zoneId); startTime = now.isAfter(startTime) ? now : startTime; try { cron = CronUtils.parse2Cron(scheduleParam.getCrontab()); } catch (CronParseException e) { logger.error(e.getMessage(), e); putMsg(result, Status.PARSE_TO_CRON_EXPRESSION_ERROR); return result; } List<ZonedDateTime> selfFireDateList = CronUtils.getSelfFireDateList(startTime, endTime, cron, Constants.PREVIEW_SCHEDULE_EXECUTE_COUNT); List<String> previewDateList = selfFireDateList.stream().map(DateUtils::dateToString).collect(Collectors.toList()); result.put(Constants.DATA_LIST, previewDateList); putMsg(result, Status.SUCCESS); return result; } /** * update process definition schedule * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode process definition code * @param scheduleExpression scheduleExpression * @param warningType warning type
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
* @param warningGroupId warning group id * @param failureStrategy failure strategy * @param workerGroup worker group * @param processInstancePriority process instance priority * @return update result code */ @Override public Map<String, Object> updateScheduleByProcessDefinitionCode(User loginUser, long projectCode, long processDefinitionCode, String scheduleExpression, WarningType warningType, int warningGroupId, FailureStrategy failureStrategy, Priority processInstancePriority, String workerGroup, long environmentCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode); if (schedule == null) { putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, processDefinitionCode); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } updateSchedule(result, schedule, processDefinition, scheduleExpression, warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode); return result; } private void updateSchedule(Map<String, Object> result, Schedule schedule, ProcessDefinition processDefinition, String scheduleExpression, WarningType warningType, int warningGroupId, FailureStrategy failureStrategy, Priority processInstancePriority, String workerGroup, long environmentCode) { if (checkValid(result, schedule.getReleaseState() == ReleaseState.ONLINE, Status.SCHEDULE_CRON_ONLINE_FORBID_UPDATE)) { return; } Date now = new Date(); if (!StringUtils.isEmpty(scheduleExpression)) { ScheduleParam scheduleParam = JSONUtils.parseObject(scheduleExpression, ScheduleParam.class); if (scheduleParam == null) { putMsg(result, Status.PARSE_TO_CRON_EXPRESSION_ERROR); return; } if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) { logger.warn("The start time must not be the same as the end"); putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME); return; } if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) { logger.warn("The start time must smaller than end time");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR); return; } schedule.setStartTime(scheduleParam.getStartTime()); schedule.setEndTime(scheduleParam.getEndTime()); if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) { putMsg(result, Status.SCHEDULE_CRON_CHECK_FAILED, scheduleParam.getCrontab()); return; } schedule.setCrontab(scheduleParam.getCrontab()); schedule.setTimezoneId(scheduleParam.getTimezoneId()); } if (warningType != null) { schedule.setWarningType(warningType); } schedule.setWarningGroupId(warningGroupId); if (failureStrategy != null) { schedule.setFailureStrategy(failureStrategy); } schedule.setWorkerGroup(workerGroup); schedule.setEnvironmentCode(environmentCode); schedule.setUpdateTime(now); schedule.setProcessInstancePriority(processInstancePriority); scheduleMapper.updateById(schedule); processDefinition.setWarningGroupId(warningGroupId); processDefinitionMapper.updateById(processDefinition); putMsg(result, Status.SUCCESS); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.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.controller; import static org.mockito.ArgumentMatchers.isA;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.User; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; public class SchedulerControllerTest extends AbstractControllerTest { private static final Logger logger = LoggerFactory.getLogger(SchedulerControllerTest.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
@MockBean(name = "schedulerService") private SchedulerService schedulerService; @Test public void testCreateSchedule() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("processDefinitionCode","40"); paramsMap.add("schedule","{'startTime':'2019-12-16 00:00:00','endTime':'2019-12-17 00:00:00','crontab':'0 0 6 * * ? *'}"); paramsMap.add("warningType",String.valueOf(WarningType.NONE)); paramsMap.add("warningGroupId","1"); paramsMap.add("failureStrategy",String.valueOf(FailureStrategy.CONTINUE)); paramsMap.add("receivers",""); paramsMap.add("receiversCc",""); paramsMap.add("workerGroupId","1"); paramsMap.add("processInstancePriority",String.valueOf(Priority.HIGH)); Mockito.when(schedulerService.insertSchedule(isA(User.class), isA(Long.class), isA(Long.class), isA(String.class), isA(WarningType.class), isA(int.class), isA(FailureStrategy.class), isA(Priority.class), isA(String.class), isA(Long.class))).thenReturn(success()); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectCode}/schedules/",123) .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test @Ignore public void testUpdateSchedule() throws Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("id","37"); paramsMap.add("schedule","{'startTime':'2019-12-16 00:00:00','endTime':'2019-12-17 00:00:00','crontab':'0 0 7 * * ? *'}"); paramsMap.add("warningType",String.valueOf(WarningType.NONE)); paramsMap.add("warningGroupId","1"); paramsMap.add("failureStrategy",String.valueOf(FailureStrategy.CONTINUE)); paramsMap.add("receivers",""); paramsMap.add("receiversCc",""); paramsMap.add("workerGroupId","1"); paramsMap.add("processInstancePriority",String.valueOf(Priority.HIGH)); Mockito.when(schedulerService.updateSchedule(isA(User.class), isA(Long.class), isA(Integer.class), isA(String.class), isA(WarningType.class), isA(Integer.class), isA(FailureStrategy.class), isA(Priority.class), isA(String.class), isA(Long.class))).thenReturn(success()); MvcResult mvcResult = mockMvc.perform(put("/projects/{projectCode}/schedules/{id}", 123, 37) .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testOnline() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("id","37"); Mockito.when(schedulerService.setScheduleState(isA(User.class), isA(Long.class), isA(Integer.class), isA(ReleaseState.class))).thenReturn(success()); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectCode}/schedules/{id}/online",123, 37)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
.header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testOffline() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("id","28"); Mockito.when(schedulerService.setScheduleState(isA(User.class), isA(Long.class), isA(Integer.class), isA(ReleaseState.class))).thenReturn(success()); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectCode}/schedules/{id}/offline",123, 28) .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryScheduleListPaging() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("processDefinitionCode","40"); paramsMap.add("searchVal","test");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
paramsMap.add("pageNo","1"); paramsMap.add("pageSize","30"); PageInfo<Resource> pageInfo = new PageInfo<>(1, 10); Result mockResult = Result.success(pageInfo); Mockito.when(schedulerService.querySchedule(isA(User.class), isA(Long.class), isA(Long.class), isA(String.class), isA(Integer.class), isA(Integer.class))).thenReturn(mockResult); MvcResult mvcResult = mockMvc.perform(get("/projects/{projectCode}/schedules/",123) .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryScheduleList() throws Exception { Mockito.when(schedulerService.queryScheduleList(isA(User.class), isA(Long.class))).thenReturn(success()); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectCode}/schedules/list",123) .header(SESSION_ID, sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testPreviewSchedule() throws Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/SchedulerControllerTest.java
Mockito.when(schedulerService.previewSchedule(isA(User.class), isA(String.class))) .thenReturn(success()); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectCode}/schedules/preview",123) .header(SESSION_ID, sessionId) .param("schedule","{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}")) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testDeleteScheduleById() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("scheduleId","37"); Mockito.when(schedulerService.deleteScheduleById(isA(User.class), isA(Long.class), isA(Integer.class))) .thenReturn(success()); MvcResult mvcResult = mockMvc.perform(delete("/projects/{projectCode}/schedules/{id}",123, 37) .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.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.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.thread.ThreadLocalContext; import org.apache.commons.lang3.StringUtils; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; import java.util.TimeZone;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class DateUtils { static final long C0 = 1L; static final long C1 = C0 * 1000L; static final long C2 = C1 * 1000L; static final long C3 = C2 * 1000L; static final long C4 = C3 * 60L; static final long C5 = C4 * 60L; static final long C6 = C5 * 24L; private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); private static final DateTimeFormatter YYYY_MM_DD_HH_MM_SS = DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS); private DateUtils() { throw new UnsupportedOperationException("Construct DateUtils"); } /** * date to local datetime * * @param date date * @return local datetime */ private static LocalDateTime date2LocalDateTime(Date date) { String timezone = ThreadLocalContext.getTimezoneThreadLocal().get(); ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault(); return date2LocalDateTime(date, zoneId); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* date to local datetime * * @param date date * @param zoneId zoneId * @return local datetime */ private static LocalDateTime date2LocalDateTime(Date date, ZoneId zoneId) { return LocalDateTime.ofInstant(date.toInstant(), zoneId); } /** * local datetime to date * * @param localDateTime local datetime * @return date */ private static Date localDateTime2Date(LocalDateTime localDateTime) { String timezone = ThreadLocalContext.getTimezoneThreadLocal().get(); ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault(); return localDateTime2Date(localDateTime, zoneId); } /** * local datetime to date * * @param localDateTime local datetime * @return date */ private static Date localDateTime2Date(LocalDateTime localDateTime, ZoneId zoneId) { Instant instant = localDateTime.atZone(zoneId).toInstant(); return Date.from(instant); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
/** * get the date string in the specified format of the current time * * @param format date format * @return date string */ public static String getCurrentTime(String format) { return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); } /** * get the formatted date string * * @param date date * @param format e.g. yyyy-MM-dd HH:mm:ss * @return date string */ public static String format(Date date, String format, String timezone) { return format(date, DateTimeFormatter.ofPattern(format), timezone); } public static String format(Date date, DateTimeFormatter dateTimeFormatter, String timezone) { LocalDateTime localDateTime = StringUtils.isEmpty(timezone) ? date2LocalDateTime(date) : date2LocalDateTime(date, ZoneId.of(timezone)); return format(localDateTime, dateTimeFormatter); } /** * get the formatted date string * * @param localDateTime local data time * @param format yyyy-MM-dd HH:mm:ss * @return date string
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
*/ public static String format(LocalDateTime localDateTime, String format) { return format(localDateTime, DateTimeFormatter.ofPattern(format)); } public static String format(LocalDateTime localDateTime, DateTimeFormatter dateTimeFormatter) { return localDateTime.format(dateTimeFormatter); } /** * convert time to yyyy-MM-dd HH:mm:ss format * * @param date date * @return date string */ public static String dateToString(Date date) { return format(date, YYYY_MM_DD_HH_MM_SS, null); } /** * convert time to yyyy-MM-dd HH:mm:ss format * * @param date date * @param timezone timezone * @return date string */ public static String dateToString(Date date, String timezone) { return format(date, YYYY_MM_DD_HH_MM_SS, timezone); } public static String dateToString(ZonedDateTime zonedDateTime) { return YYYY_MM_DD_HH_MM_SS.format(zonedDateTime); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* convert string to date and time * * @param date date * @param format format * @param timezone timezone, if null, use system default timezone * @return date */ public static Date parse(String date, String format, String timezone) { return parse(date, DateTimeFormatter.ofPattern(format), timezone); } public static Date parse(String date, DateTimeFormatter dateTimeFormatter, String timezone) { try { LocalDateTime ldt = LocalDateTime.parse(date, dateTimeFormatter); if (StringUtils.isEmpty(timezone)) { return localDateTime2Date(ldt); } return localDateTime2Date(ldt, ZoneId.of(timezone)); } catch (Exception e) { logger.error("error while parse date:" + date, e); } return null; } public static ZonedDateTime parseZoneDateTime(@Nonnull String date, @Nonnull DateTimeFormatter dateTimeFormatter, @Nullable String timezone) { ZonedDateTime zonedDateTime = ZonedDateTime.parse(date, dateTimeFormatter); if (StringUtils.isNotEmpty(timezone)) { return zonedDateTime.withZoneSameInstant(ZoneId.of(timezone)); } return zonedDateTime; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
/** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param date date string * @return yyyy-MM-dd HH:mm:ss format */ public static @Nullable Date stringToDate(String date) { return parse(date, YYYY_MM_DD_HH_MM_SS, null); } public static ZonedDateTime stringToZoneDateTime(@Nonnull String date) { Date d = stringToDate(date); if (d == null) { throw new IllegalArgumentException(String.format( "data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss ", date)); } return ZonedDateTime.ofInstant(d.toInstant(), ZoneId.systemDefault()); } /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param date date string * @param timezone * @return yyyy-MM-dd HH:mm:ss format */ public static Date stringToDate(String date, String timezone) { return parse(date, YYYY_MM_DD_HH_MM_SS, timezone); } /** * get seconds between two dates
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* * @param d1 date1 * @param d2 date2 * @return differ seconds */ public static long differSec(Date d1, Date d2) { if (d1 == null || d2 == null) { return 0; } return (long) Math.ceil(differMs(d1, d2) / 1000.0); } /** * get ms between two dates * * @param d1 date1 * @param d2 date2 * @return differ ms */ public static long differMs(Date d1, Date d2) { return Math.abs(d1.getTime() - d2.getTime()); } /** * get the date of the specified date in the days before and after * * @param date date * @param day day * @return the date of the specified date in the days before and after */ public static Date getSomeDay(Date date, int day) { Calendar calendar = Calendar.getInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
calendar.setTime(date); calendar.add(Calendar.DATE, day); return calendar.getTime(); } /** * get the hour of day. * * @param date date * @return hour of day */ public static int getHourIndex(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.HOUR_OF_DAY); } /** * compare two dates * * @param future future date * @param old old date * @return true if future time greater than old time */ public static boolean compare(Date future, Date old) { return future.getTime() > old.getTime(); } /** * format time to readable * * @param ms ms * @return format time
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
*/ public static String format2Readable(long ms) { long days = MILLISECONDS.toDays(ms); long hours = MILLISECONDS.toDurationHours(ms); long minutes = MILLISECONDS.toDurationMinutes(ms); long seconds = MILLISECONDS.toDurationSeconds(ms); return String.format("%02d %02d:%02d:%02d", days, hours, minutes, seconds); } /** * format time to duration * * @param d1 d1 * @param d2 d2 * @return format time */ public static String format2Duration(Date d1, Date d2) { if (d1 == null || d2 == null) { return null; } return format2Duration(differMs(d1, d2)); } /** * format time to duration * * @param ms ms * @return format time */ public static String format2Duration(long ms) { long days = MILLISECONDS.toDays(ms); long hours = MILLISECONDS.toDurationHours(ms);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
long minutes = MILLISECONDS.toDurationMinutes(ms); long seconds = MILLISECONDS.toDurationSeconds(ms); StringBuilder strBuilder = new StringBuilder(); strBuilder = days > 0 ? strBuilder.append(days).append("d").append(" ") : strBuilder; strBuilder = hours > 0 ? strBuilder.append(hours).append("h").append(" ") : strBuilder; strBuilder = minutes > 0 ? strBuilder.append(minutes).append("m").append(" ") : strBuilder; strBuilder = seconds > 0 ? strBuilder.append(seconds).append("s") : strBuilder; return strBuilder.toString(); } /** * get monday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date * @return get monday */ public static Date getMonday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return cal.getTime(); } /** * get sunday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* @return get sunday */ public static Date getSunday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); return cal.getTime(); } /** * get first day of month * * @param date date * @return first day of month */ public static Date getFirstDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, 1); return cal.getTime(); } /** * get some hour of day * * @param date date * @param offsetHour hours * @return some hour of day */ public static Date getSomeHourOfDay(Date date, int offsetHour) { Calendar cal = Calendar.getInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + offsetHour); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * get last day of month * * @param date date * @return get last day of month */ public static Date getLastDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MONTH, 1); cal.set(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.DAY_OF_MONTH, -1); return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay date * @return start day */ public static Date getStartOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of day */ public static Date getEndOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay day * @return start of hour */ public static Date getStartOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of hour */ public static Date getEndOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); } /** * get current date * * @return current date */ public static Date getCurrentDate() { return new Date(); } /** * get date *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* @param date date * @param calendarField calendarField * @param amount amount * @return date */ public static Date add(final Date date, final int calendarField, final int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return c.getTime(); } /** * starting from the current time, get how many seconds are left before the target time. * targetTime = baseTime + intervalSeconds * * @param baseTime base time * @param intervalSeconds a period of time * @return the number of seconds */ public static long getRemainTime(Date baseTime, long intervalSeconds) { if (baseTime == null) { return 0; } long usedTime = (System.currentTimeMillis() - baseTime.getTime()) / 1000; return intervalSeconds - usedTime; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* get current time stamp : yyyyMMddHHmmssSSS * * @return date string */ public static String getCurrentTimeStamp() { return getCurrentTime(Constants.YYYYMMDDHHMMSSSSS); } /** * transform date to target timezone date * sourceTimeZoneId is system default timezone */ public static Date transformTimezoneDate(Date date, String targetTimezoneId) { return transformTimezoneDate(date, ZoneId.systemDefault().getId(), targetTimezoneId); } /** * transform date from source timezone date to target timezone date * <p>e.g. * <p> if input date is `Thu Apr 28 10:00:00 UTC 2022`, sourceTimezoneId is UTC * <p>targetTimezoneId is Asia/Shanghai * <p>this method will return `Thu Apr 28 02:00:00 UTC 2022` */ public static Date transformTimezoneDate(Date date, String sourceTimezoneId, String targetTimezoneId) { if (StringUtils.isEmpty(sourceTimezoneId) || StringUtils.isEmpty(targetTimezoneId)) { return date; } String dateToString = dateToString(date, sourceTimezoneId); LocalDateTime localDateTime = LocalDateTime.parse(dateToString, DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS)); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, TimeZone.getTimeZone(targetTimezoneId).toZoneId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
return Date.from(zonedDateTime.toInstant()); } /** * get timezone by timezoneId */ public static TimeZone getTimezone(String timezoneId) { if (StringUtils.isEmpty(timezoneId)) { return null; } return TimeZone.getTimeZone(timezoneId); } /** * Time unit representing one thousandth of a second */ public static class MILLISECONDS { public static long toDays(long d) { return d / (C6 / C2); } public static long toDurationSeconds(long d) { return (d % (C4 / C2)) / (C3 / C2); } public static long toDurationMinutes(long d) { return (d % (C5 / C2)) / (C4 / C2); } public static long toDurationHours(long d) { return (d % (C6 / C2)) / (C5 / C2); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.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.common.utils; import org.apache.dolphinscheduler.common.thread.ThreadLocalContext; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import javax.management.timer.Timer; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class DateUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
@Before public void before() { ThreadLocalContext.getTimezoneThreadLocal().remove(); } @After public void after() { ThreadLocalContext.getTimezoneThreadLocal().remove(); } @Test public void format2Readable() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String start = "2015-12-21 18:00:36"; Date startDate = sdf.parse(start); String end = "2015-12-23 03:23:44"; Date endDate = sdf.parse(end); String readableDate = DateUtils.format2Readable(endDate.getTime() - startDate.getTime()); Assert.assertEquals("01 09:23:08", readableDate); } @Test public void testWeek() { Date curr = DateUtils.stringToDate("2019-02-01 00:00:00"); Date monday1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date sunday1 = DateUtils.stringToDate("2019-02-03 00:00:00"); Date monday = DateUtils.getMonday(curr);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
Date sunday = DateUtils.getSunday(monday); Assert.assertEquals(monday, monday1); Assert.assertEquals(sunday, sunday1); } @Test public void dateToString() { Date d1 = DateUtils.stringToDate("2019-01-28"); Assert.assertNull(d1); d1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Assert.assertEquals(DateUtils.dateToString(d1), "2019-01-28 00:00:00"); } @Test public void getSomeDay() { Date d1 = DateUtils.stringToDate("2019-01-31 00:00:00"); Date curr = DateUtils.getSomeDay(d1, 1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-01 00:00:00"); Assert.assertEquals(DateUtils.dateToString(DateUtils.getSomeDay(d1, -31)), "2018-12-31 00:00:00"); } @Test public void getFirstDayOfMonth() { Date d1 = DateUtils.stringToDate("2019-01-31 00:00:00"); Date curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 00:00:00"); d1 = DateUtils.stringToDate("2019-01-31 01:59:00"); curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 01:59:00"); } @Test public void getSomeHourOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
Date curr = DateUtils.getSomeHourOfDay(d1, -1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 10:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 0); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 2); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 13:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 24); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-01 11:00:00"); } @Test public void getLastDayOfMonth() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59"); Date curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); d1 = DateUtils.stringToDate("2019-01-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); d1 = DateUtils.stringToDate("2019-02-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-28 11:59:59"); d1 = DateUtils.stringToDate("2020-02-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2020-02-29 11:59:59"); } @Test public void getStartOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59"); Date curr = DateUtils.getStartOfDay(d1); String expected = new SimpleDateFormat("yyyy-MM-dd").format(d1) + " 00:00:00"; Assert.assertEquals(DateUtils.dateToString(curr), expected);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
} @Test public void getEndOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getEndOfDay(d1); String expected = new SimpleDateFormat("yyyy-MM-dd").format(d1) + " 23:59:59"; Assert.assertEquals(DateUtils.dateToString(curr), expected); } @Test public void getStartOfHour() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getStartOfHour(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:00:00"); } @Test public void getEndOfHour() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getEndOfHour(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); } @Test public void getCurrentTimeStamp() { String timeStamp = DateUtils.getCurrentTimeStamp(); Assert.assertNotNull(timeStamp); } @Test public void testFormat2Duration() { Date d1 = DateUtils.stringToDate("2020-01-20 11:00:00"); Date d2 = DateUtils.stringToDate("2020-01-21 12:10:10");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
String duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("1d 1h 10m 10s", duration); d1 = DateUtils.stringToDate("2020-01-20 11:00:00"); d2 = DateUtils.stringToDate("2020-01-20 12:10:10"); duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("1h 10m 10s", duration); d1 = DateUtils.stringToDate("2020-01-20 11:00:00"); d2 = DateUtils.stringToDate("2020-01-20 11:10:10"); duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("10m 10s", duration); d1 = DateUtils.stringToDate("2020-01-20 11:10:00"); d2 = DateUtils.stringToDate("2020-01-20 11:10:10"); duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("10s", duration); d1 = DateUtils.stringToDate("2020-01-20 11:10:00"); d2 = DateUtils.stringToDate("2020-01-21 11:10:10"); duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("1d 10s", duration); d1 = DateUtils.stringToDate("2020-01-20 11:10:00"); d2 = DateUtils.stringToDate("2020-01-20 16:10:10"); duration = DateUtils.format2Duration(d2, d1); Assert.assertEquals("5h 10s", duration); } @Test public void testNullDuration() { Date d1 = DateUtils.stringToDate("2020-01-20 11:00:00");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,833
[Bug] [Quartz] timezone display doesn't match the next_fire_time in ds 3.0.0-beta1 version
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I set the quartz time with UTC timezone first time,the execute time and the next five execute time match right.But the task didn't execute at all.So I went to chekc the dolphinscheduler meta table in mysql.I found three tables which are qrzt_triggers and qrtz_cron_triggers and t_ds_schedules.I found the column NEXT_FIRE_TIME showed the time I had set in qrtz_triggers table.The NEXT_FIRE_TIME showed 1657202700000 which means 2022-07-07 22:05:00,Finally I found the bug.Beacuse the ui diplay didn't mean the real execute time. ![image](https://user-images.githubusercontent.com/21135052/177737948-cca6f985-faac-4663-875f-39e3fa26da81.png) ![image](https://user-images.githubusercontent.com/21135052/177738023-1c64de5b-8863-4291-b138-ee905c2ecf8e.png) ![image](https://user-images.githubusercontent.com/21135052/177737742-f1d791e8-f472-4fae-a8bf-e715b5db7a0f.png) ### What you expected to happen <img width="315" alt="84a91d1d39974b575945674f539e8de" src="https://user-images.githubusercontent.com/21135052/177745159-d205e4bc-6bcb-4600-8fc3-fa7d3c92c984.png"> ### How to reproduce ds 3.0.0-beta1 quartz set module ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10833
https://github.com/apache/dolphinscheduler/pull/10865
73f4846c49a95e5e84e3a6b1102c115e4a031c0a
030fb89d6e44875d08ff34d3cd99ee475de13f42
2022-07-07T09:17:29Z
java
2022-07-09T14:28:08Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
Date d2 = null; Assert.assertNull(DateUtils.format2Duration(d1, d2)); } @Test public void testTransformToTimezone() { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Date date = new Date(); Date defaultTimeZoneDate = DateUtils.transformTimezoneDate(date, TimeZone.getDefault().getID()); Assert.assertEquals(DateUtils.dateToString(date), DateUtils.dateToString(defaultTimeZoneDate)); Date targetTimeZoneDate = DateUtils.transformTimezoneDate(date, TimeZone.getDefault().getID(), "Asia/Shanghai"); Assert.assertEquals(DateUtils.dateToString(date, TimeZone.getDefault().getID()), DateUtils.dateToString(targetTimeZoneDate, "Asia/Shanghai")); } @Test public void testGetTimezone() { Assert.assertNull(DateUtils.getTimezone(null)); Assert.assertEquals(TimeZone.getTimeZone("MST"), DateUtils.getTimezone("MST")); } @Test public void testTimezone() { String time = "2019-01-28 00:00:00"; ThreadLocalContext.timezoneThreadLocal.set("UTC"); Date utcDate = DateUtils.stringToDate(time); Assert.assertEquals(time, DateUtils.dateToString(utcDate)); ThreadLocalContext.timezoneThreadLocal.set("Asia/Shanghai"); Date shanghaiDate = DateUtils.stringToDate(time); Assert.assertEquals(time, DateUtils.dateToString(shanghaiDate)); Assert.assertEquals(Timer.ONE_HOUR * 8, utcDate.getTime() - shanghaiDate.getTime()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; import org.apache.dolphinscheduler.api.dto.CommandStateCount; import org.apache.dolphinscheduler.api.dto.DefineUserDto; import org.apache.dolphinscheduler.api.dto.TaskCountDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.DataAnalysisService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.TriFunction; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.CommandMapper; import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper; 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.TaskInstanceMapper; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.service.process.ProcessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT_OVERVIEW; /** * data analysis service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnalysisService { private static final Logger logger = LoggerFactory.getLogger(DataAnalysisServiceImpl.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private CommandMapper commandMapper; @Autowired private ErrorCommandMapper errorCommandMapper; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ProcessService processService; /** * statistical task instance status data * * @param loginUser login user * @param projectCode project code * @param startDate start date * @param endDate end date * @return task state count data */ @Override public Map<String, Object> countTaskStateByProject(User loginUser, long projectCode, String startDate, String endDate) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
return countStateByProject( loginUser, projectCode, startDate, endDate, this::countTaskInstanceAllStatesByProjectCodes); } /** * statistical process instance status data * * @param loginUser login user * @param projectCode project code * @param startDate start date * @param endDate end date * @return process instance state count data */ @Override public Map<String, Object> countProcessInstanceStateByProject(User loginUser, long projectCode, String startDate, String endDate) { Map<String, Object> result = this.countStateByProject( loginUser, projectCode, startDate, endDate, (start, end, projectCodes) -> this.processInstanceMapper.countInstanceStateByProjectCodes(start, end, projectCodes)); if (result.containsKey(Constants.STATUS) && result.get(Constants.STATUS).equals(Status.SUCCESS)) { ((TaskCountDto) result.get(Constants.DATA_LIST)).removeStateFromCountList(ExecutionStatus.FORCED_SUCCESS); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
/** * Wrapper function of counting process instance state and task state * * @param loginUser login user * @param projectCode project code * @param startDate start date * @param endDate end date */ private Map<String, Object> countStateByProject(User loginUser, long projectCode, String startDate, String endDate , TriFunction<Date, Date, Long[], List<ExecuteStatusCount>> instanceStateCounter) { Map<String, Object> result = new HashMap<>(); if (projectCode != 0) { Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode,PROJECT_OVERVIEW); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } } Date start = null; Date end = null; if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) { start = DateUtils.stringToDate(startDate); end = DateUtils.stringToDate(endDate); if (Objects.isNull(start) || Objects.isNull(end)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.START_END_DATE); return result; } } Pair<Set<Integer>, Map<String, Object>> projectIds = getProjectIds(loginUser, result); if (projectIds.getRight() != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
return projectIds.getRight(); } Long[] projectCodeArray = projectCode == 0 ? getProjectCodesArrays(projectIds.getLeft()) : new Long[]{projectCode}; List<ExecuteStatusCount> processInstanceStateCounts = new ArrayList<>(); if (projectCodeArray.length != 0 || loginUser.getUserType() == UserType.ADMIN_USER) { processInstanceStateCounts = instanceStateCounter.apply(start, end, projectCodeArray); } if (processInstanceStateCounts != null) { TaskCountDto taskCountResult = new TaskCountDto(processInstanceStateCounts); result.put(Constants.DATA_LIST, taskCountResult); putMsg(result, Status.SUCCESS); } return result; } /** * statistics the process definition quantities of a certain person * <p> * We only need projects which users have permission to see to determine whether the definition belongs to the user or not. * * @param loginUser login user * @param projectCode project code * @return definition count data */ @Override public Map<String, Object> countDefinitionByUser(User loginUser, long projectCode) { Map<String, Object> result = new HashMap<>(); if (projectCode != 0) { Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode,PROJECT_OVERVIEW); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
return result; } } List<DefinitionGroupByUser> defineGroupByUsers = new ArrayList<>(); Pair<Set<Integer>, Map<String, Object>> projectIds = getProjectIds(loginUser, result); if (projectIds.getRight() != null) { List<DefinitionGroupByUser> emptyList = new ArrayList<>(); DefineUserDto dto = new DefineUserDto(emptyList); result.put(Constants.DATA_LIST, dto); putMsg(result, Status.SUCCESS); return result; } Long[] projectCodeArray = projectCode == 0 ? getProjectCodesArrays(projectIds.getLeft()) : new Long[]{projectCode}; if (projectCodeArray.length != 0 || loginUser.getUserType() == UserType.ADMIN_USER) { defineGroupByUsers = processDefinitionMapper.countDefinitionByProjectCodes(projectCodeArray); } DefineUserDto dto = new DefineUserDto(defineGroupByUsers); result.put(Constants.DATA_LIST, dto); putMsg(result, Status.SUCCESS); return result; } /** * statistical command status data * * @param loginUser login user * @return command state count data */ @Override public Map<String, Object> countCommandState(User loginUser) { Map<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
/** * find all the task lists in the project under the user * statistics based on task status execution, failure, completion, wait, total */ Date start = null; Date end = null; Pair<Set<Integer>, Map<String, Object>> projectIds = getProjectIds(loginUser, result); if (projectIds.getRight() != null) { List<CommandStateCount> noData = Arrays.stream(CommandType.values()).map(commandType -> new CommandStateCount(0, 0, commandType)).collect(Collectors.toList()); result.put(Constants.DATA_LIST, noData); putMsg(result, Status.SUCCESS); return result; } Long[] projectCodeArray = getProjectCodesArrays(projectIds.getLeft()); int userId = loginUser.getUserType() == UserType.ADMIN_USER ? 0 : loginUser.getId(); Map<CommandType, Integer> normalCountCommandCounts = commandMapper.countCommandState(userId, start, end, projectCodeArray) .stream() .collect(Collectors.toMap(CommandCount::getCommandType, CommandCount::getCount)); Map<CommandType, Integer> errorCommandCounts = errorCommandMapper.countCommandState(userId, start, end, projectCodeArray) .stream() .collect(Collectors.toMap(CommandCount::getCommandType, CommandCount::getCount)); List<CommandStateCount> list = Arrays.stream(CommandType.values()) .map(commandType -> new CommandStateCount( errorCommandCounts.getOrDefault(commandType, 0), normalCountCommandCounts.getOrDefault(commandType, 0), commandType) ).collect(Collectors.toList()); result.put(Constants.DATA_LIST, list);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } private Pair<Set<Integer>, Map<String, Object>> getProjectIds(User loginUser, Map<String, Object> result) { Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); if (projectIds.isEmpty()) { List<ExecuteStatusCount> taskInstanceStateCounts = new ArrayList<>(); result.put(Constants.DATA_LIST, new TaskCountDto(taskInstanceStateCounts)); putMsg(result, Status.SUCCESS); return Pair.of(null, result); } return Pair.of(projectIds, null); } private Long[] getProjectCodesArrays(Set<Integer> projectIds) { List<Project> projects = projectMapper.selectBatchIds(projectIds); List<Long> codeList = projects.stream().map(Project::getCode).collect(Collectors.toList()); Long[] projectCodeArray = new Long[codeList.size()]; codeList.toArray(projectCodeArray); return projectCodeArray; } /** * count queue state * * @return queue state count data */ @Override public Map<String, Object> countQueueState(User loginUser) { Map<String, Object> result = new HashMap<>(); Map<String, Integer> dataMap = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
dataMap.put("taskQueue", 0); dataMap.put("taskKill", 0); result.put(Constants.DATA_LIST, dataMap); putMsg(result, Status.SUCCESS); return result; } @Override public List<ExecuteStatusCount> countTaskInstanceAllStatesByProjectCodes(Date startTime, Date endTime, Long[] projectCodes) { Optional<List<ExecuteStatusCount>> startTimeStates = Optional.ofNullable(this.taskInstanceMapper.countTaskInstanceStateByProjectCodes(startTime, endTime, projectCodes)); List<ExecutionStatus> allState = Arrays.stream(ExecutionStatus.values()).collect(Collectors.toList()); List<ExecutionStatus> needRecountState; if (startTimeStates.isPresent() && startTimeStates.get().size() != 0) { List<ExecutionStatus> instanceState = startTimeStates.get().stream().map(ExecuteStatusCount::getExecutionStatus).collect(Collectors.toList()); needRecountState = allState.stream().filter(ele -> !instanceState.contains(ele)).collect(Collectors.toList()); if (needRecountState.size() == 0) { return startTimeStates.get(); } } else { needRecountState = allState; } List<ExecuteStatusCount> recounts = this.taskInstanceMapper .countTaskInstanceStateByProjectCodesAndStatesBySubmitTime(startTime, endTime, projectCodes, needRecountState); startTimeStates.orElseGet(ArrayList::new).addAll(recounts); return startTimeStates.orElse(null); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/aspect/AccessLogAspectTest.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.aspect; import org.junit.Assert; import org.junit.jupiter.api.Test; /** * @author Hua Jiang */ public class AccessLogAspectTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/aspect/AccessLogAspectTest.java
private AccessLogAspect accessLogAspect = new AccessLogAspect(); @Test public void testHandleSensitiveData() { String data = "userPassword='7ad2410b2f4c074479a8937a28a22b8f', email='[email protected]', database='null', userName='root', password='root', other='null'"; String expected = "userPassword='********************************', email='[email protected]', database='null', userName='root', password='****', other='null'"; String actual = accessLogAspect.handleSensitiveData(data); Assert.assertEquals(expected, actual); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.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; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT_OVERVIEW; import static org.assertj.core.api.Assertions.assertThat;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import org.apache.dolphinscheduler.api.dto.CommandStateCount; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl; import org.apache.dolphinscheduler.api.service.impl.DataAnalysisServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.CommandMapper; import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper; 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.TaskInstanceMapper; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
import java.util.List; import java.util.Map; import java.util.Set; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * data analysis service test */ @RunWith(PowerMockRunner.class) public class DataAnalysisServiceTest { private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class); private static final Logger serviceLogger = LoggerFactory.getLogger(DataAnalysisServiceImpl.class); @InjectMocks private DataAnalysisServiceImpl dataAnalysisServiceImpl; @Mock ProjectMapper projectMapper; @Mock ProjectService projectService; @Mock ProcessInstanceMapper processInstanceMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
@Mock ProcessDefinitionMapper processDefinitionMapper; @Mock CommandMapper commandMapper; @Mock ErrorCommandMapper errorCommandMapper; @Mock TaskInstanceMapper taskInstanceMapper; @Mock private ResourcePermissionCheckService resourcePermissionCheckService; private Map<String, Object> resultMap; private User user; @Before public void setUp() { user = new User(); user.setId(1); Project project = new Project(); project.setId(1); project.setName("test"); resultMap = new HashMap<>(); Mockito.when(projectMapper.selectById(1)).thenReturn(project); Mockito.when(projectService.hasProjectAndPerm(user, project, resultMap,PROJECT_OVERVIEW)).thenReturn(true); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(project); } @After public void after() { user = null; projectMapper = null; resultMap = null; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
@Test public void testCountTaskStateByProject_success() { String startDate = "2020-02-11 16:02:18"; String endDate = "2020-02-11 16:03:18"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(), any())).thenReturn(result); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); Mockito.when(taskInstanceMapper.countTaskInstanceStateByProjectCodes(DateUtils.stringToDate(startDate), DateUtils.stringToDate(endDate), new Long[] {1L})).thenReturn(getTaskInstanceStateCounts()); Mockito.when(projectMapper.selectById(Mockito.any())).thenReturn(getProject("test")); Mockito.when(projectService.hasProjectAndPerm(Mockito.any(), Mockito.any(), (Map<String, Object>) Mockito.any(), Mockito.any())).thenReturn(true); result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCountTaskStateByProject_projectNotFound() { String startDate = "2020-02-11 16:02:18"; String endDate = "2020-02-11 16:03:18"; Map<String, Object> failResult = new HashMap<>(); putMsg(failResult, Status.PROJECT_NOT_FOUND, 1); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(),any())).thenReturn(failResult); failResult = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.PROJECT_NOT_FOUND, failResult.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
} @Test public void testCountTaskStateByProject_paramValid() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(),any())).thenReturn(result); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); String startDate2 = "illegalDateString"; String endDate2 = "illegalDateString"; result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate2, endDate2); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS)); String startDate3 = "2020-08-28 14:13:40"; String endDate3 = "illegalDateString"; result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate3, endDate3); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS)); String startDate4 = "illegalDateString"; String endDate4 = "2020-08-28 14:13:40"; result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate4, endDate4); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS)); } @Test public void testCountTaskStateByProject_allCountZero() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(),any())).thenReturn(result); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
user.setUserType(UserType.GENERAL_USER); Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, 1, serviceLogger)) .thenReturn(projectIds()); Mockito.when(taskInstanceMapper.countTaskInstanceStateByProjectCodes(any(), any(), any())).thenReturn( Collections.emptyList()); result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, null, null); assertThat(result.get(Constants.DATA_LIST)).extracting("totalCount").isEqualTo(0); assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").asList().hasSameSizeAs( ExecutionStatus.values()); assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").asList().extracting( "count").allMatch(count -> count.equals(0)); } @Test public void testCountTaskStateByProject_noData() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(),any())).thenReturn(result); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, 1, serviceLogger)).thenReturn(projectIds()); user.setUserType(UserType.GENERAL_USER); PowerMockito.when(taskInstanceMapper.countTaskInstanceStateByProjectCodes(any(), any(), any())).thenReturn(null); result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, null, null); Assert.assertNull(result.get(Constants.DATA_LIST)); } @Test public void testCountProcessInstanceStateByProject() { String startDate = "2020-02-11 16:02:18"; String endDate = "2020-02-11 16:03:18"; Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
Map<String, Object> failResult = new HashMap<>(); putMsg(failResult, Status.PROJECT_NOT_FOUND, 1); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(), any())).thenReturn(failResult); failResult = dataAnalysisServiceImpl.countProcessInstanceStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.PROJECT_NOT_FOUND, failResult.get(Constants.STATUS)); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(), any())).thenReturn(result); Mockito.when(processInstanceMapper.countInstanceStateByProjectCodes(DateUtils.stringToDate(startDate), DateUtils.stringToDate(endDate), new Long[] {1L})).thenReturn(getTaskInstanceStateCounts()); Mockito.when(projectService.hasProjectAndPerm(Mockito.any(), Mockito.any(), (Map<String, Object>) Mockito.any(), Mockito.any())).thenReturn(true); result = dataAnalysisServiceImpl.countProcessInstanceStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCountDefinitionByUser() { Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), anyLong(),any())).thenReturn(result); Mockito.when(processDefinitionMapper.countDefinitionByProjectCodes( Mockito.any(Long[].class))).thenReturn(new ArrayList<DefinitionGroupByUser>()); Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, 1, serviceLogger)).thenReturn(projectIds()); result = dataAnalysisServiceImpl.countDefinitionByUser(user, 0);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, 1, serviceLogger)).thenReturn(Collections.emptySet()); result = dataAnalysisServiceImpl.countDefinitionByUser(user, 0); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCountCommandState() { User user = new User(); user.setUserType(UserType.ADMIN_USER); user.setId(1); List<CommandCount> commandCounts = new ArrayList<>(1); CommandCount commandCount = new CommandCount(); commandCount.setCommandType(CommandType.START_PROCESS); commandCounts.add(commandCount); Mockito.when(commandMapper.countCommandState(0, null, null, new Long[]{1L})).thenReturn(commandCounts); Mockito.when(errorCommandMapper.countCommandState(0, null, null, new Long[]{1L})).thenReturn(commandCounts); Map<String, Object> result = dataAnalysisServiceImpl.countCommandState(user); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); Mockito.when(commandMapper.countCommandState(anyInt(), any(), any(), any())).thenReturn(Collections.emptyList()); Mockito.when(errorCommandMapper.countCommandState(anyInt(), any(), any(), any())).thenReturn(Collections.emptyList()); Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, 1, serviceLogger)).thenReturn(projectIds()); Map<String, Object> result5 = dataAnalysisServiceImpl.countCommandState(user); assertThat(result5).containsEntry(Constants.STATUS, Status.SUCCESS); assertThat(result5.get(Constants.DATA_LIST)).asList().extracting("errorCount").allMatch(count -> count.equals(0)); assertThat(result5.get(Constants.DATA_LIST)).asList().extracting("normalCount").allMatch(count -> count.equals(0)); CommandCount normalCommandCount = new CommandCount(); normalCommandCount.setCommandType(CommandType.START_PROCESS); normalCommandCount.setCount(10);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
CommandCount errorCommandCount = new CommandCount(); errorCommandCount.setCommandType(CommandType.START_PROCESS); errorCommandCount.setCount(5); Mockito.when(commandMapper.countCommandState(anyInt(), any(), any(), any())).thenReturn(Collections.singletonList(normalCommandCount)); Mockito.when(errorCommandMapper.countCommandState(anyInt(), any(), any(), any())).thenReturn(Collections.singletonList(errorCommandCount)); Map<String, Object> result6 = dataAnalysisServiceImpl.countCommandState(user); assertThat(result6).containsEntry(Constants.STATUS, Status.SUCCESS); CommandStateCount commandStateCount = new CommandStateCount(); commandStateCount.setCommandState(CommandType.START_PROCESS); commandStateCount.setNormalCount(10); commandStateCount.setErrorCount(5); assertThat(result6.get(Constants.DATA_LIST)).asList().containsOnlyOnce(commandStateCount); } @Test public void testCountQueueState() { Map<String, Object> result2 = dataAnalysisServiceImpl.countQueueState(user); assertThat(result2.get(Constants.DATA_LIST)).extracting("taskQueue", "taskKill") .isNotEmpty() .allMatch(count -> count.equals(0)); } private Set<Integer> projectIds() { Set<Integer> projectIds = new HashSet<>(); projectIds.add(1); return projectIds; } /** * get list */ private List<ExecuteStatusCount> getTaskInstanceStateCounts() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java
List<ExecuteStatusCount> taskInstanceStateCounts = new ArrayList<>(1); ExecuteStatusCount executeStatusCount = new ExecuteStatusCount(); executeStatusCount.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); taskInstanceStateCounts.add(executeStatusCount); return taskInstanceStateCounts; } /** * get mock Project * * @param projectName projectName * @return Project */ private Project getProject(String projectName) { Project project = new Project(); project.setCode(1L); project.setId(1); project.setName(projectName); project.setUserId(1); return project; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/CommandMapper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * command mapper interface */ public interface CommandMapper extends BaseMapper<Command> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/CommandMapper.java
/** * count command state * @param userId userId * @param startTime startTime * @param endTime endTime * @param projectCodeArray projectCodeArray * @return CommandCount list */ List<CommandCount> countCommandState( @Param("userId") int userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("projectCodeArray") Long[] projectCodeArray); /** * query command page * @return */ List<Command> queryCommandPage(@Param("limit") int limit, @Param("offset") int offset); /** * query command page by slot * @return command list */ List<Command> queryCommandPageBySlot(@Param("limit") int limit, @Param("offset") int offset, @Param("masterCount") int masterCount, @Param("thisMasterSlot") int thisMasterSlot); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.dolphinscheduler.dao.entity.ErrorCommand; import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * error command mapper interface */ public interface ErrorCommandMapper extends BaseMapper<ErrorCommand> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapper.java
/** * count command state * @param userId * @param startTime startTime * @param endTime endTime * @param projectCodeArray projectCodeArray * @return CommandCount list */ List<CommandCount> countCommandState( @Param("userId") int userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("projectCodeArray") Long[] projectCodeArray); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.mapper; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; /** * command mapper test */ public class CommandMapperTest extends BaseDaoTest { @Autowired private CommandMapper commandMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; /** * test insert */ @Test public void testInsert() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
Command command = createCommand(); assertThat(command.getId(),greaterThan(0)); } /** * test select by id */ @Test public void testSelectById() { Command expectedCommand = createCommand(); Command actualCommand = commandMapper.selectById(expectedCommand.getId()); assertNotNull(actualCommand); assertEquals(expectedCommand.getProcessDefinitionCode(), actualCommand.getProcessDefinitionCode()); } /** * test update */ @Test public void testUpdate() { Command expectedCommand = createCommand(); expectedCommand.setUpdateTime(DateUtils.getCurrentDate()); commandMapper.updateById(expectedCommand); Command actualCommand = commandMapper.selectById(expectedCommand.getId()); assertNotNull(actualCommand); assertEquals(expectedCommand.getUpdateTime(),actualCommand.getUpdateTime()); } /** * test delete */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
@Test public void testDelete() { Command expectedCommand = createCommand(); commandMapper.deleteById(expectedCommand.getId()); Command actualCommand = commandMapper.selectById(expectedCommand.getId()); assertNull(actualCommand); } /** * test query all */ @Test public void testGetAll() { Integer count = 10; Map<Integer, Command> commandMap = createCommandMap(count); List<Command> actualCommands = commandMapper.selectList(null); assertThat(actualCommands.size(), greaterThanOrEqualTo(count)); } /** * test get on command to run */ @Test public void testGetOneToRun() { ProcessDefinition processDefinition = createProcessDefinition(); createCommand(CommandType.START_PROCESS, processDefinition.getCode()); List<Command> actualCommand = commandMapper.queryCommandPage(1,0); assertNotNull(actualCommand); } /** * test count command state */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
@Test public void testCountCommandState() { Integer count = 10; ProcessDefinition processDefinition = createProcessDefinition(); createCommandMap(count, CommandType.START_PROCESS, processDefinition.getCode()); Long[] projectCodeArray = {processDefinition.getProjectCode()}; Date startTime = DateUtils.stringToDate("2019-12-29 00:10:00"); Date endTime = DateUtils.stringToDate("2019-12-29 23:59:59"); List<CommandCount> actualCommandCounts = commandMapper.countCommandState(0, startTime, endTime, projectCodeArray); assertThat(actualCommandCounts.size(),greaterThanOrEqualTo(1)); } /** * test query command page by slot */ @Test public void testQueryCommandPageBySlot() { int masterCount = 4; int thisMasterSlot = 2; toTestQueryCommandPageBySlot(masterCount,thisMasterSlot); toTestQueryCommandPageBySlot(masterCount,thisMasterSlot); toTestQueryCommandPageBySlot(masterCount,thisMasterSlot); toTestQueryCommandPageBySlot(masterCount,thisMasterSlot); } private boolean toTestQueryCommandPageBySlot(int masterCount, int thisMasterSlot) { Command command = createCommand(); int id = command.getId(); boolean hit = id % masterCount == thisMasterSlot; List<Command> commandList = commandMapper.queryCommandPageBySlot(1, 0, masterCount, thisMasterSlot); if (hit) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
assertEquals(id,commandList.get(0).getId()); } else { commandList.forEach(o -> { assertNotEquals(id, o.getId()); assertEquals(thisMasterSlot, o.getId() % masterCount); }); } return hit; } /** * create command map * @param count map count * @param commandType comman type * @param processDefinitionCode process definition code * @return command map */ private CommandCount createCommandMap( Integer count, CommandType commandType, long processDefinitionCode) { CommandCount commandCount = new CommandCount(); for (int i = 0;i < count;i++) { createCommand(commandType, processDefinitionCode); } commandCount.setCommandType(commandType); commandCount.setCount(count); return commandCount; } /** * create process definition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
* @return process definition */ private ProcessDefinition createProcessDefinition() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setCode(1L); processDefinition.setReleaseState(ReleaseState.ONLINE); processDefinition.setName("ut test"); processDefinition.setProjectCode(1L); processDefinition.setFlag(Flag.YES); processDefinition.setCreateTime(new Date()); processDefinition.setUpdateTime(new Date()); processDefinitionMapper.insert(processDefinition); return processDefinition; } /** * create command map * @param count map count * @return command map */ private Map<Integer,Command> createCommandMap(Integer count) { Map<Integer,Command> commandMap = new HashMap<>(); for (int i = 0;i < count;i++) { Command command = createCommand(); commandMap.put(command.getId(),command); } return commandMap; } /** * create command * @return
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/CommandMapperTest.java
*/ private Command createCommand() { return createCommand(CommandType.START_PROCESS,1); } /** * create command * @return Command */ private Command createCommand(CommandType commandType, long processDefinitionCode) { Command command = new Command(); command.setCommandType(commandType); command.setProcessDefinitionCode(processDefinitionCode); command.setExecutorId(4); command.setCommandParam("test command param"); command.setTaskDependType(TaskDependType.TASK_ONLY); command.setFailureStrategy(FailureStrategy.CONTINUE); command.setWarningType(WarningType.ALL); command.setWarningGroupId(1); command.setScheduleTime(DateUtils.stringToDate("2019-12-29 12:10:00")); command.setProcessInstancePriority(Priority.MEDIUM); command.setStartTime(DateUtils.stringToDate("2019-12-29 10:10:00")); command.setUpdateTime(DateUtils.stringToDate("2019-12-29 10:10:00")); command.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP); command.setProcessInstanceId(0); command.setProcessDefinitionVersion(0); commandMapper.insert(command); return command; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapperTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.CommandCount; import org.apache.dolphinscheduler.dao.entity.ErrorCommand; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import java.util.Date; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; public class ErrorCommandMapperTest extends BaseDaoTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapperTest.java
@Autowired private ErrorCommandMapper errorCommandMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; /** * insert * @return ErrorCommand */ private ErrorCommand insertOne() { ErrorCommand errorCommand = new ErrorCommand(); errorCommand.setId(10101); errorCommand.setCommandType(CommandType.START_PROCESS); errorCommand.setUpdateTime(new Date()); errorCommand.setStartTime(new Date()); errorCommandMapper.insert(errorCommand); return errorCommand; } /** * test query */ @Test public void testQuery() { ErrorCommand errorCommand = insertOne();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,863
[BUG-BE][Statistics Module] The number of failed commands is incorrectly counted
### 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 The number of failed commands is incorrectly counted ### What you expected to happen display correctly ### How to reproduce The data in the database is inconsistent with the page data display. ### Anything else No ### 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/10863
https://github.com/apache/dolphinscheduler/pull/10864
598290487c837478cd2afe630cb2f25521e9d5ee
3756a233d8a266899ebc75800d55ec4067a3f818
2022-07-09T08:11:10Z
java
2022-07-10T09:17:35Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapperTest.java
ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setCode(1L); processDefinition.setName("def 1"); processDefinition.setProjectCode(1010L); processDefinition.setUserId(101); processDefinition.setUpdateTime(new Date()); processDefinition.setCreateTime(new Date()); processDefinitionMapper.insert(processDefinition); errorCommand.setProcessDefinitionCode(processDefinition.getCode()); errorCommandMapper.updateById(errorCommand); List<CommandCount> commandCounts = errorCommandMapper.countCommandState( 0, null, null, new Long[0] ); Long[] projectCodeArray = new Long[2]; projectCodeArray[0] = processDefinition.getProjectCode(); projectCodeArray[1] = 200L; List<CommandCount> commandCounts2 = errorCommandMapper.countCommandState( 0, null, null, projectCodeArray ); Assert.assertNotEquals(commandCounts.size(), 0); Assert.assertNotEquals(commandCounts2.size(), 0); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* limitations under the License. */ package org.apache.dolphinscheduler.api.python; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.apache.commons.collections.CollectionUtils; import org.apache.dolphinscheduler.api.configuration.PythonGatewayConfiguration; import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.ResourcesService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.service.TaskDefinitionService; import org.apache.dolphinscheduler.api.service.TenantService; import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ComplementDependentMode; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.Queue; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import py4j.GatewayServer; @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public class PythonGateway { private static final Logger logger = LoggerFactory.getLogger(PythonGateway.class); private static final FailureStrategy DEFAULT_FAILURE_STRATEGY = FailureStrategy.CONTINUE; private static final Priority DEFAULT_PRIORITY = Priority.MEDIUM; private static final Long DEFAULT_ENVIRONMENT_CODE = -1L; private static final TaskDependType DEFAULT_TASK_DEPEND_TYPE = TaskDependType.TASK_POST; private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL; private static final int DEFAULT_DRY_RUN = 0; private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProjectService projectService; @Autowired private TenantService tenantService; @Autowired private ExecutorService executorService; @Autowired private ProcessDefinitionService processDefinitionService; @Autowired private TaskDefinitionService taskDefinitionService; @Autowired private UsersService usersService; @Autowired private ResourcesService resourceService; @Autowired private ProjectMapper projectMapper; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private ScheduleMapper scheduleMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired private PythonGatewayConfiguration pythonGatewayConfiguration; @Autowired private ProjectUserMapper projectUserMapper; private final User dummyAdminUser = new User() { { setId(Integer.MAX_VALUE); setUserName("dummyUser"); setUserType(UserType.ADMIN_USER); } }; private final Queue queuePythonGateway = new Queue() { { setId(Integer.MAX_VALUE); setQueueName("queuePythonGateway"); } }; public String ping() { return "PONG"; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public Map<String, Object> genTaskCodeList(Integer genNum) { return taskDefinitionService.genTaskCodeList(genNum); } public Map<String, Long> getCodeAndVersion(String projectName, String processDefinitionName, String taskName) throws CodeGenerateUtils.CodeGenerateException { Project project = projectMapper.queryByName(projectName); Map<String, Long> result = new HashMap<>(); if (project == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName); if (processDefinition == null) { String msg = String.format("Can not find valid process definition by name %s", processDefinitionName); logger.error(msg); throw new IllegalArgumentException(msg); } TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), processDefinition.getCode(), taskName); if (taskDefinition == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); } else { result.put("code", taskDefinition.getCode()); result.put("version", (long) taskDefinition.getVersion()); } return result; } /** * create or update process definition.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* If process definition do not exists in Project=`projectCode` would create a new one * If process definition already exists in Project=`projectCode` would update it * * @param userName user name who create or update process definition * @param projectName project name which process definition belongs to * @param name process definition name * @param description description * @param globalParams global params * @param schedule schedule for process definition, will not set schedule if null, * and if would always fresh exists schedule if not null * @param warningType warning type * @param warningGroupId warning group id * @param locations locations json object about all tasks * @param timeout timeout for process definition working, if running time longer than timeout, * task will mark as fail * @param workerGroup run task in which worker group * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @param otherParamsJson otherParamsJson handle other params * @return create result code */ public Long createOrUpdateProcessDefinition(String userName, String projectName, String name, String description, String globalParams, String schedule, String warningType, int warningGroupId,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
String locations, int timeout, String workerGroup, String tenantCode, int releaseState, String taskRelationJson, String taskDefinitionJson, String otherParamsJson, ProcessExecutionTypeEnum executionType) { User user = usersService.queryUser(userName); Project project = projectMapper.queryByName(projectName); long projectCode = project.getCode(); ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, name); long processDefinitionCode; if (processDefinition != null) { processDefinitionCode = processDefinition.getCode(); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType); } else { Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType); processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST); processDefinitionCode = processDefinition.getCode(); } if (schedule != null) { createOrUpdateSchedule(user, projectCode, processDefinitionCode, schedule, workerGroup, warningType, warningGroupId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
} processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.getEnum(releaseState)); return processDefinitionCode; } /** * get process definition * * @param user user who create or update schedule * @param projectCode project which process definition belongs to * @param processDefinitionName process definition name */ private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) { Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, processDefinitionName); Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS); ProcessDefinition processDefinition = null; if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) { processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); } else if (verifyStatus != Status.SUCCESS) { String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST."; logger.error(msg); throw new RuntimeException(msg); } return processDefinition; } /** * create or update process definition schedule. * It would always use latest schedule define in workflow-as-code, and set schedule online when * it's not null * * @param user user who create or update schedule
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* @param projectCode project which process definition belongs to * @param processDefinitionCode process definition code * @param schedule schedule expression * @param workerGroup work group * @param warningType warning type * @param warningGroupId warning group id */ private void createOrUpdateSchedule(User user, long projectCode, long processDefinitionCode, String schedule, String workerGroup, String warningType, int warningGroupId) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode); int scheduleId; if (scheduleObj == null) { processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE); Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, WarningType.valueOf(warningType), warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); scheduleId = (int) result.get("scheduleId"); } else { scheduleId = scheduleObj.getId(); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, WarningType.valueOf(warningType), warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); } schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public void execProcessInstance(String userName, String projectName, String processDefinitionName, String cronTime, String workerGroup, String warningType, int warningGroupId, Integer timeout ) { User user = usersService.queryUser(userName); Project project = projectMapper.queryByName(projectName); ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName); processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE); executorService.execProcessInstance(user, project.getCode(), processDefinition.getCode(), cronTime, null, DEFAULT_FAILURE_STRATEGY, null, DEFAULT_TASK_DEPEND_TYPE, WarningType.valueOf(warningType), warningGroupId, DEFAULT_RUN_MODE, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE, timeout, null,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,822
[Improvement][Python] Python-gate supports creating or editing resources.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10822
https://github.com/apache/dolphinscheduler/pull/10823
499e5b1307665928f2a17e878d091ac593adbfd8
59cd86157ff8d5ab25f0b200d6a30abd95a64c03
2022-07-07T02:40:19Z
java
2022-07-12T12:44:59Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
null, DEFAULT_DRY_RUN, COMPLEMENT_DEPENDENT_MODE ); } /* Grant project's permission to user. Use when project's created user not current but Python API use it to change process definition. */ private Integer grantProjectToUser(Project project, User user) { Date now = new Date(); ProjectUser projectUser = new ProjectUser(); projectUser.setUserId(user.getId()); projectUser.setProjectId(project.getId()); projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM); projectUser.setCreateTime(now); projectUser.setUpdateTime(now); return projectUserMapper.insert(projectUser); } /* Grant or create project. Create a new project if project do not exists, and grant the project permission to user if project exists but without permission to this user. */ public void createOrGrantProject(String userName, String name, String desc) { User user = usersService.queryUser(userName); Project project; project = projectMapper.queryByName(name); if (project == null) { projectService.createProject(user, name, desc);