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
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
*/ 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(); 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
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); 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();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
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); 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
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 DateUtils.parse(DateUtils.getCurrentTime(), Constants.YYYY_MM_DD_HH_MM_SS); } /** * get date * * @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();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
} /** * 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; } /** * get current time stamp : yyyyMMddHHmmssSSS * * @return date string */ public static String getCurrentTimeStamp() { return getCurrentTime(Constants.YYYYMMDDHHMMSSSSS); } /** * transform date to target timezone date * <p>e.g. * <p> if input date is 2020-01-01 00:00:00 current timezone is CST * <p>targetTimezoneId is MST * <p>this method will return 2020-01-01 15:00:00
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
*/ public static Date getTimezoneDate(Date date, String targetTimezoneId) { if (StringUtils.isEmpty(targetTimezoneId)) { return date; } String dateToString = dateToString(date); LocalDateTime localDateTime = LocalDateTime.parse(dateToString, DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS)); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, TimeZone.getTimeZone(targetTimezoneId).toZoneId()); 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); } 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; /** * Time unit representing one thousandth of a second */ public static class MILLISECONDS {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
public static long toSeconds(long d) { return d / (C3 / C2); } public static long toMinutes(long d) { return d / (C4 / C2); } public static long toHours(long d) { return d / (C5 / C2); } 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
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
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 java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import org.junit.Assert; import org.junit.Test; public class DateUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
@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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
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); Date sunday = DateUtils.getSunday(monday); Assert.assertEquals(monday, monday1); Assert.assertEquals(sunday, sunday1); } @Test public void diffHours() { Date d1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date d2 = DateUtils.stringToDate("2019-01-28 20:00:00"); Assert.assertEquals(DateUtils.diffHours(d1, d2), 20); Date d3 = DateUtils.stringToDate("2019-01-28 20:00:00"); Assert.assertEquals(DateUtils.diffHours(d3, d2), 0); Assert.assertEquals(DateUtils.diffHours(d2, d1), 20); Date d4 = null; Assert.assertEquals(DateUtils.diffHours(d2, d4), 0); } @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");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
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"); 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");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
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); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 00:00:00"); } @Test public void getEndOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getEndOfDay(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 23:59:59"); } @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() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
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"); 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
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"); Date d2 = null; Assert.assertNull(DateUtils.format2Duration(d1, d2)); } @Test public void testTransformToTimezone() { Date date = new Date(); Date mst = DateUtils.getTimezoneDate(date, TimeZone.getDefault().getID()); Assert.assertEquals(DateUtils.dateToString(date), DateUtils.dateToString(mst)); } @Test public void testGetTimezone() { Assert.assertNull(DateUtils.getTimezone(null)); Assert.assertEquals(TimeZone.getTimeZone("MST"), DateUtils.getTimezone("MST")); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.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.server.worker.task.http; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.io.Charsets; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.HttpMethod; import org.apache.dolphinscheduler.common.enums.HttpParametersType; import org.apache.dolphinscheduler.common.process.HttpProperty;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.task.http.HttpParameters; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ParamUtils; import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.http.HttpEntity; import org.apache.http.ParseException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.methods.RequestBuilder; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * http task */ public class HttpTask extends AbstractTask { /** * http parameters
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
*/ private HttpParameters httpParameters; /** * application json */ protected static final String APPLICATION_JSON = "application/json"; /** * output */ protected String output; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * constructor * @param taskExecutionContext taskExecutionContext * @param logger logger */ public HttpTask(TaskExecutionContext taskExecutionContext, Logger logger) { super(taskExecutionContext, logger); this.taskExecutionContext = taskExecutionContext; } @Override public void init() { logger.info("http task params {}", taskExecutionContext.getTaskParams()); this.httpParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), HttpParameters.class); if (!httpParameters.checkParameters()) { throw new RuntimeException("http task params is not valid"); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
} @Override public void handle() throws Exception { String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId()); Thread.currentThread().setName(threadLoggerInfoName); long startTime = System.currentTimeMillis(); String statusCode = null; String body = null; try(CloseableHttpClient client = createHttpClient(); CloseableHttpResponse response = sendRequest(client)) { statusCode = String.valueOf(getStatusCode(response)); body = getResponseBody(response); exitStatusCode = validResponse(body, statusCode); long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(),httpParameters.getHttpMethod(), costTime, statusCode, body, output); }catch (Exception e){ appendMessage(e.toString()); exitStatusCode = -1; logger.error("httpUrl[" + httpParameters.getUrl() + "] connection failed:"+output, e); throw e; } } /** * send request * @param client client * @return CloseableHttpResponse * @throws IOException io exception */ protected CloseableHttpResponse sendRequest(CloseableHttpClient client) throws IOException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
RequestBuilder builder = createRequestBuilder(); // Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), taskExecutionContext.getDefinedParams(), httpParameters.getLocalParametersMap(), httpParameters.getVarPoolMap(), CommandType.of(taskExecutionContext.getCmdTypeIfComplement()), taskExecutionContext.getScheduleTime()); List<HttpProperty> httpPropertyList = new ArrayList<>(); if(CollectionUtils.isNotEmpty(httpParameters.getHttpParams() )){ for (HttpProperty httpProperty: httpParameters.getHttpParams()) { String jsonObject = JSONUtils.toJsonString(httpProperty); String params = ParameterUtils.convertParameterPlaceholders(jsonObject,ParamUtils.convert(paramsMap)); logger.info("http request params:{}",params); httpPropertyList.add(JSONUtils.parseObject(params,HttpProperty.class)); } } addRequestParams(builder,httpPropertyList); String requestUrl = ParameterUtils.convertParameterPlaceholders(httpParameters.getUrl(),ParamUtils.convert(paramsMap)); HttpUriRequest request = builder.setUri(requestUrl).build(); setHeaders(request,httpPropertyList); return client.execute(request); } /** * get response body * @param httpResponse http response * @return response body * @throws ParseException parse exception * @throws IOException io exception */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
protected String getResponseBody(CloseableHttpResponse httpResponse) throws ParseException, IOException { if (httpResponse == null) { return null; } HttpEntity entity = httpResponse.getEntity(); if (entity == null) { return null; } return EntityUtils.toString(entity, StandardCharsets.UTF_8.name()); } /** * get status code * @param httpResponse http response * @return status code */ protected int getStatusCode(CloseableHttpResponse httpResponse) { return httpResponse.getStatusLine().getStatusCode(); } /** * valid response * @param body body * @param statusCode status code * @return exit status code */ protected int validResponse(String body, String statusCode){ int exitStatusCode = 0; switch (httpParameters.getHttpCheckCondition()) { case BODY_CONTAINS: if (StringUtils.isEmpty(body) || !body.contains(httpParameters.getCondition())) { appendMessage(httpParameters.getUrl() + " doesn contain "
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
+ httpParameters.getCondition()); exitStatusCode = -1; } break; case BODY_NOT_CONTAINS: if (StringUtils.isEmpty(body) || body.contains(httpParameters.getCondition())) { appendMessage(httpParameters.getUrl() + " contains " + httpParameters.getCondition()); exitStatusCode = -1; } break; case STATUS_CODE_CUSTOM: if (!statusCode.equals(httpParameters.getCondition())) { appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: " + httpParameters.getCondition()); exitStatusCode = -1; } break; default: if (!"200".equals(statusCode)) { appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: 200"); exitStatusCode = -1; } break; } return exitStatusCode; } public String getOutput() { return output; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
* append message * @param message message */ protected void appendMessage(String message) { if (output == null) { output = ""; } if (message != null && !message.trim().isEmpty()) { output += message; } } /** * add request params * @param builder buidler * @param httpPropertyList http property list */ protected void addRequestParams(RequestBuilder builder,List<HttpProperty> httpPropertyList) { if(CollectionUtils.isNotEmpty(httpPropertyList)){ ObjectNode jsonParam = JSONUtils.createObjectNode(); for (HttpProperty property: httpPropertyList){ if(property.getHttpParametersType() != null){ if (property.getHttpParametersType().equals(HttpParametersType.PARAMETER)){ builder.addParameter(property.getProp(), property.getValue()); }else if(property.getHttpParametersType().equals(HttpParametersType.BODY)){ jsonParam.put(property.getProp(), property.getValue()); } } } StringEntity postingString = new StringEntity(jsonParam.toString(), Charsets.UTF_8); postingString.setContentEncoding(StandardCharsets.UTF_8.name());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
postingString.setContentType(APPLICATION_JSON); builder.setEntity(postingString); } } /** * set headers * @param request request * @param httpPropertyList http property list */ protected void setHeaders(HttpUriRequest request,List<HttpProperty> httpPropertyList) { if(CollectionUtils.isNotEmpty(httpPropertyList)){ for (HttpProperty property: httpPropertyList) { if (HttpParametersType.HEADERS.equals(property.getHttpParametersType())) { request.addHeader(property.getProp(), property.getValue()); } } } } /** * create http client * @return CloseableHttpClient */ protected CloseableHttpClient createHttpClient() { final RequestConfig requestConfig = requestConfig(); HttpClientBuilder httpClientBuilder; httpClientBuilder = HttpClients.custom().setDefaultRequestConfig(requestConfig); return httpClientBuilder.build(); } /** * request config
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,795
[Improvement][Server] The starttime field in the HttpTask log is not displayed as expected.
*For better global communication, please give priority to using English description, thx! * *Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.* **Describe the question** ![image](https://user-images.githubusercontent.com/52202080/125186281-0e512680-e25c-11eb-8d5c-59d54640709d.png) ```java long costTime = System.currentTimeMillis() - startTime; logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}", DateUtils.format2Readable(startTime), httpParameters.getUrl(), httpParameters.getHttpMethod(), costTime, statusCode, body, output); 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); } ``` The API `format2Readable` is intended to display the execution time of a task more friendly, such as how many days and hours it has been executed. It's better to convert the timestamp to a formatted time according to a specified `DateTimeFormatter` **Which version of DolphinScheduler:** latest dev branch **Describe alternatives you've considered** A clear and concise description of any alternative improvement solutions you've considered.
https://github.com/apache/dolphinscheduler/issues/5795
https://github.com/apache/dolphinscheduler/pull/5796
16986c3c651af38469c6d4cb03a587fd174c9a9b
7bffe0ac85b0147210facdeedc531026b0022e6f
"2021-07-11T07:49:32Z"
java
"2021-07-12T06:31:48Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTask.java
* @return RequestConfig */ private RequestConfig requestConfig() { return RequestConfig.custom().setSocketTimeout(httpParameters.getSocketTimeout()).setConnectTimeout(httpParameters.getConnectTimeout()).build(); } /** * create request builder * @return RequestBuilder */ protected RequestBuilder createRequestBuilder() { if (httpParameters.getHttpMethod().equals(HttpMethod.GET)) { return RequestBuilder.get(); } else if (httpParameters.getHttpMethod().equals(HttpMethod.POST)) { return RequestBuilder.post(); } else if (httpParameters.getHttpMethod().equals(HttpMethod.HEAD)) { return RequestBuilder.head(); } else if (httpParameters.getHttpMethod().equals(HttpMethod.PUT)) { return RequestBuilder.put(); } else if (httpParameters.getHttpMethod().equals(HttpMethod.DELETE)) { return RequestBuilder.delete(); } else { return null; } } @Override public AbstractParameters getParameters() { return this.httpParameters; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.DataSourceService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
import org.apache.dolphinscheduler.common.datasource.ConnectionParam; import org.apache.dolphinscheduler.common.datasource.DatasourceUtil; import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; import java.sql.Connection; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereo.Service; import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.node.ObjectNode; /** * data source service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
public class DataSourceServiceImpl extends BaseServiceImpl implements DataSourceService { private static final Logger logger = LoggerFactory.getLogger(DataSourceServiceImpl.class); @Autowired private DataSourceMapper dataSourceMapper; @Autowired private DataSourceUserMapper datasourceUserMapper; /** * create data source * * @param loginUser login user * @param datasourceParam datasource parameters * @return create result code */ @Override public Result<Object> createDataSource(User loginUser, BaseDataSourceParamDTO datasourceParam) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
DatasourceUtil.checkDatasourceParam(datasourceParam); Result<Object> result = new Result<>(); if (checkName(datasourceParam.getName())) { putMsg(result, Status.DATASOURCE_EXIST); return result; } ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(datasourceParam); Result<Object> isConnection = checkConnection(datasourceParam.getType(), connectionParam); if (Status.SUCCESS.getCode() != isConnection.getCode()) { putMsg(result, Status.DATASOURCE_CONNECT_FAILED); return result; } DataSource dataSource = new DataSource(); Date now = new Date(); dataSource.setName(datasourceParam.getName().trim()); dataSource.setNote(datasourceParam.getNote()); dataSource.setUserId(loginUser.getId()); dataSource.setUserName(loginUser.getUserName()); dataSource.setType(datasourceParam.getType()); dataSource.setConnectionParams(JSONUtils.toJsonString(connectionParam)); dataSource.setCreateTime(now); dataSource.setUpdateTime(now); try { dataSourceMapper.insert(dataSource); putMsg(result, Status.SUCCESS); } catch (DuplicateKeyException ex) { logger.error("Create datasource error.", ex);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
putMsg(result, Status.DATASOURCE_EXIST); } return result; } /** * updateProcessInstance datasource * * @param loginUser login user * @param name data source name * @param desc data source description * @param data source * @param parameter datasource parameters * @param id data source id * @return update result code */ @Override public Result<Object> updateDataSource(int id, User loginUser, BaseDataSourceParamDTO dataSourceParam) { DatasourceUtil.checkDatasourceParam(dataSourceParam); Result<Object> result = new Result<>(); DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, dataSource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
if (!dataSource.getName().trim().equals(dataSource.getName()) && checkName(dataSource.getName())) { putMsg(result, Status.DATASOURCE_EXIST); return result; } BaseConnectionParam connectionParam = (BaseConnectionParam) DatasourceUtil.buildConnectionParams(dataSourceParam); String password = connectionParam.getPassword(); if (StringUtils.isBlank(password)) { String oldConnectionParams = dataSource.getConnectionParams(); ObjectNode oldParams = JSONUtils.parseObject(oldConnectionParams); connectionParam.setPassword(oldParams.path(Constants.PASSWORD).asText()); } Result<Object> isConnection = checkConnection(dataSource.getType(), connectionParam); if (isConnection.isFailed()) { return isConnection; } Date now = new Date(); dataSource.setName(dataSource.getName().trim()); dataSource.setNote(dataSourceParam.getNote()); dataSource.setUserName(loginUser.getUserName()); dataSource.setType(dataSource.getType()); dataSource.setConnectionParams(JSONUtils.toJsonString(connectionParam)); dataSource.setUpdateTime(now); try { dataSourceMapper.updateById(dataSource); putMsg(result, Status.SUCCESS); } catch (DuplicateKeyException ex) { logger.error("Update datasource error.", ex); putMsg(result, Status.DATASOURCE_EXIST); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
return result; } private boolean checkName(String name) { List<DataSource> queryDataSource = dataSourceMapper.queryDataSourceByName(name.trim()); return queryDataSource != null && !queryDataSource.isEmpty(); } /** * updateProcessInstance datasource * * @param id datasource id * @return data source detail */ @Override public Map<String, Object> queryDataSource(int id) { Map<String, Object> result = new HashMap<>(); DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } // BaseDataSourceParamDTO baseDataSourceParamDTO = DatasourceUtil.buildDatasourceParamDTO( dataSource.getType(), dataSource.getConnectionParams()); baseDataSourceParamDTO.setId(dataSource.getId()); baseDataSourceParamDTO.setName(dataSource.getName()); baseDataSourceParamDTO.setNote(dataSource.getNote()); result.put(Constants.DATA_LIST, baseDataSourceParamDTO); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
/** * query datasource list by keyword * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return data source list page */ @Override public Map<String, Object> queryDataSourceListPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Map<String, Object> result = new HashMap<>(); IPage<DataSource> dataSourceList; Page<DataSource> dataSourcePage = new Page<>(pageNo, pageSize); if (isAdmin(loginUser)) { dataSourceList = dataSourceMapper.selectPaging(dataSourcePage, 0, searchVal); } else { dataSourceList = dataSourceMapper.selectPaging(dataSourcePage, loginUser.getId(), searchVal); } List<DataSource> dataSources = dataSourceList != null ? dataSourceList.getRecords() : new ArrayList<>(); handlePasswd(dataSources); PageInfo<DataSource> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int) (dataSourceList != null ? dataSourceList.getTotal() : 0L)); pageInfo.setLists(dataSources); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * handle datasource connection password for safety
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ private void handlePasswd(List<DataSource> dataSourceList) { for (DataSource dataSource : dataSourceList) { String connectionParams = dataSource.getConnectionParams(); ObjectNode object = JSONUtils.parseObject(connectionParams); object.put(Constants.PASSWORD, getHiddenPassword()); dataSource.setConnectionParams(object.toString()); } } /** * get hidden password (resolve the security hotspot) * * @return hidden password */ private String getHiddenPassword() { return Constants.XXXXXX; } /** * query data resource list * * @param loginUser login user * @param data source * @return data source list page */ @Override public Map<String, Object> queryDataSourceList(User loginUser, Integer ) { Map<String, Object> result = new HashMap<>(); List<DataSource> datasourceList; if (isAdmin(loginUser)) { datasourceList = dataSourceMapper.listAllDataSourceByType();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
} else { datasourceList = dataSourceMapper.queryDataSourceByType(loginUser.getId(), ); } result.put(Constants.DATA_LIST, datasourceList); putMsg(result, Status.SUCCESS); return result; } /** * verify datasource exists * * @param name datasource name * @return true if data datasource not exists, otherwise return false */ @Override public Result<Object> verifyDataSourceName(String name) { Result<Object> result = new Result<>(); List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(name); if (dataSourceList != null && !dataSourceList.isEmpty()) { putMsg(result, Status.DATASOURCE_EXIST); } else { putMsg(result, Status.SUCCESS); } return result; } /** * check connection * * @param data source * @param parameter data source parameters * @return true if connect successfully, otherwise false
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
*/ @Override public Result<Object> checkConnection(DbType , ConnectionParam connectionParam) { Result<Object> result = new Result<>(); try (Connection connection = DatasourceUtil.getConnection(, connectionParam)) { if (connection == null) { putMsg(result, Status.CONNECTION_TEST_FAILURE); return result; } putMsg(result, Status.SUCCESS); return result; } catch (Exception e) { logger.error("datasource test connection error, dbType:{}, connectionParam:{}, message:{}.", , connectionParam, e.getMessage()); return new Result<>(Status.CONNECTION_TEST_FAILURE.getCode(), e.getMessage()); } } /** * test connection * * @param id datasource id * @return connect result code */ @Override public Result<Object> connectionTest(int id) { DataSource dataSource = dataSourceMapper.selectById(id); if (dataSource == null) { Result<Object> result = new Result<>(); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
return checkConnection(dataSource.getType(), DatasourceUtil.buildConnectionParams(dataSource.getType(), dataSource.getConnectionParams())); } /** * delete datasource * * @param loginUser login user * @param datasourceId data source id * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Result<Object> delete(User loginUser, int datasourceId) { Result<Object> result = new Result<>(); try { // DataSource dataSource = dataSourceMapper.selectById(datasourceId); if (dataSource == null) { logger.error("resource id {} not exist", datasourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, dataSource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } dataSourceMapper.deleteById(datasourceId); datasourceUserMapper.deleteByDatasourceId(datasourceId); putMsg(result, Status.SUCCESS); } catch (Exception e) { logger.error("delete datasource error", e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
throw new RuntimeException("delete datasource error"); } return result; } /** * unauthorized datasource * * @param loginUser login user * @param userId user id * @return unauthed data source result code */ @Override public Map<String, Object> unauthDatasource(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); // if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } /** * query all data sources except userId */ List<DataSource> resultList = new ArrayList<>(); List<DataSource> datasourceList = dataSourceMapper.queryDatasourceExceptUserId(userId); Set<DataSource> datasourceSet = null; if (datasourceList != null && !datasourceList.isEmpty()) { datasourceSet = new HashSet<>(datasourceList); List<DataSource> authedDataSourceList = dataSourceMapper.queryAuthedDatasource(userId); Set<DataSource> authedDataSourceSet = null; if (authedDataSourceList != null && !authedDataSourceList.isEmpty()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,726
[Improvement][UI] When we used the UI page, we found some problems such as parameter validation, parameter update shows success but actually work
### 1.When editing an existing data source, the data source type does not actually support switching, preferably not editing ![image](https://user-images.githubusercontent.com/52202080/123957653-a3435c80-d9de-11eb-8097-f14fc890586c.png) ![image](https://user-images.githubusercontent.com/52202080/123956430-46937200-d9dd-11eb-8bec-dc394ad0c654.png) ### 2.When editing an existing data source, the name of the existing data source is changed to show success, but does not actually take effect. ### 3.When a token is created, the expiration time can be set to empty, result in an illegal parameter and it can create success: ![image](https://user-images.githubusercontent.com/52202080/123960033-6af14d80-d9e1-11eb-87d6-1438962a8245.png) ![image](https://user-images.githubusercontent.com/52202080/123960120-82c8d180-d9e1-11eb-8df0-dc3598a6a0aa.png) ### 4.Non-Admin user profile page does not display tenant information ![image](https://user-images.githubusercontent.com/52202080/123957087-f8cb3980-d9dd-11eb-9b8f-ee349ee7eb91.png) ![image](https://user-images.githubusercontent.com/52202080/123957281-2d3ef580-d9de-11eb-9813-ef5c8311994d.png)
https://github.com/apache/dolphinscheduler/issues/5726
https://github.com/apache/dolphinscheduler/pull/5727
00e76558be001dc72cf60f4db93c881ed98db95a
1f0c67bfb772f46a0e7d6289b13a499aae403fe3
"2021-06-30T12:28:11Z"
java
"2021-07-14T05:51:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
authedDataSourceSet = new HashSet<>(authedDataSourceList); datasourceSet.removeAll(authedDataSourceSet); } resultList = new ArrayList<>(datasourceSet); } result.put(Constants.DATA_LIST, resultList); putMsg(result, Status.SUCCESS); return result; } /** * authorized datasource * * @param loginUser login user * @param userId user id * @return authorized result code */ @Override public Map<String, Object> authedDatasource(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } List<DataSource> authedDatasourceList = dataSourceMapper.queryAuthedDatasource(userId); result.put(Constants.DATA_LIST, authedDatasourceList); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.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.datasource; import org.apache.commons.collections4.MapUtils; import java.util.Map; import java.util.regex.Pattern; public abstract class AbstractDatasourceProcessor implements DatasourceProcessor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.java
private static final Pattern IPV4_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$"); private static final Pattern IPV6_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\:\\[\\]]+$"); private static final Pattern DATABASE_PATTER = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$"); private static final Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$"); @Override public void checkDatasourceParam(BaseDataSourceParamDTO baseDataSourceParamDTO) { checkHost(baseDataSourceParamDTO.getHost()); checkDatasourcePatter(baseDataSourceParamDTO.getDatabase()); checkOther(baseDataSourceParamDTO.getOther()); } /** * Check the host is valid * * @param host datasource host */ protected void checkHost(String host) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.java
if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) { throw new IllegalArgumentException("datasource host illegal"); } } /** * check database name is valid * * @param database database name */ protected void checkDatasourcePatter(String database) { if (!DATABASE_PATTER.matcher(database).matches()) { throw new IllegalArgumentException("datasource name illegal"); } } /** * check other is valid * * @param other other */ protected void checkOther(Map<String, String> other) { if (MapUtils.isEmpty(other)) { return; } boolean paramsCheck = other.entrySet().stream().allMatch(p -> PARAMS_PATTER.matcher(p.getValue()).matches()); if (!paramsCheck) { throw new IllegalArgumentException("datasource other params illegal"); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.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.datasource; import org.apache.dolphinscheduler.common.datasource.mysql.MysqlConnectionParam; import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceProcessor; import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.JSONUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest({Class.class, DriverManager.class, MysqlDatasourceProcessor.class}) public class DatasourceUtilTest { @Test public void testCheckDatasourceParam() { MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setOther(null); DatasourceUtil.checkDatasourceParam(mysqlDatasourceParamDTO); Assert.assertTrue(true); } @Test public void testBuildConnectionParams() { MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setPort(3306); mysqlDatasourceParamDTO.setPassword("123456");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java
ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(mysqlDatasourceParamDTO); Assert.assertNotNull(connectionParam); } @Test public void testBuildConnectionParams2() { MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setPort(3306); mysqlDatasourceParamDTO.setPassword("123456"); ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(DbType.MYSQL, JSONUtils.toJsonString(mysqlDatasourceParamDTO)); Assert.assertNotNull(connectionParam); } @Test public void testGetConnection() throws ClassNotFoundException, SQLException { PowerMockito.mockStatic(Class.class); PowerMockito.when(Class.forName(Mockito.any())).thenReturn(null); PowerMockito.mockStatic(DriverManager.class); PowerMockito.when(DriverManager.getConnection(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null); MysqlConnectionParam connectionParam = new MysqlConnectionParam(); connectionParam.setUser("root"); connectionParam.setPassword("123456"); Connection connection = DatasourceUtil.getConnection(DbType.MYSQL, connectionParam); Assert.assertNull(connection); } @Test public void testGetJdbcUrl() { MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3308");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,737
[Bug][Datasource] datsource other param check error
when add a mysql datasource, I wan't to set connec param with `serverTimezone=Asia/Shanghai` so add other param with json format `{"serverTimezone":"Asia/Shanghai"}` but the check rule make the param not working. the `Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9]+$");` make '/' illegal.
https://github.com/apache/dolphinscheduler/issues/5737
https://github.com/apache/dolphinscheduler/pull/5835
9ae2266cd40071db86cd02da829e39529f74fbeb
2df6ee1efbe4aec0f5579315a1b19e247f4115a6
"2021-07-02T06:02:42Z"
java
"2021-07-18T13:46:58Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java
String jdbcUrl = DatasourceUtil.getJdbcUrl(DbType.MYSQL, mysqlConnectionParam); Assert.assertEquals("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false", jdbcUrl); } @Test public void testBuildDatasourceParamDTO() { MysqlConnectionParam connectionParam = new MysqlConnectionParam(); connectionParam.setJdbcUrl("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"); connectionParam.setAddress("jdbc:mysql://localhost:3308"); connectionParam.setUser("root"); connectionParam.setPassword("123456"); Assert.assertNotNull(DatasourceUtil.buildDatasourceParamDTO(DbType.MYSQL, JSONUtils.toJsonString(connectionParam))); } @Test public void testGetDatasourceProcessor() { Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.MYSQL)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.POSTGRESQL)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.HIVE)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.SPARK)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.CLICKHOUSE)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.ORACLE)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.SQLSERVER)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.DB2)); Assert.assertNotNull(DatasourceUtil.getDatasourceProcessor(DbType.PRESTO)); } @Test(expected = Exception.class) public void testGetDatasourceProcessorError() { DatasourceUtil.getDatasourceProcessor(null); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.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.apache.dolphinscheduler.api.enums.Status.QUERY_WORKFLOW_LINEAGE_ERROR;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java
import static org.apache.dolphinscheduler.common.Constants.SESSION_USER; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.service.WorkFlowLineageService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkFlowLineage; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import springfox.documentation.annotations.ApiIgnore; /** * work flow lineage controller */ @Api(tags = "WORK_FLOW_LINEAGE_TAG")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java
@RestController @RequestMapping("lineages/{projectId}") public class WorkFlowLineageController extends BaseController { private static final Logger logger = LoggerFactory.getLogger(WorkFlowLineageController.class); @Autowired private WorkFlowLineageService workFlowLineageService; @ApiOperation(value = "queryWorkFlowLineageByName", notes = "QUERY_WORKFLOW_LINEAGE_BY_NAME_NOTES") @GetMapping(value = "/list-name") @ResponseStatus(HttpStatus.OK) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result<List<WorkFlowLineage>> queryWorkFlowLineageByName(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, @ApiParam(name = "projectId", value = "PROJECT_ID", required = true, example = "1") @PathVariable int projectId, @ApiIgnore @RequestParam(value = "searchVal", required = false) String searchVal) { try { searchVal = ParameterUtils.handleEscapes(searchVal); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByName(searchVal,projectId); return returnDataList(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java
} catch (Exception e) { logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); } } @ApiOperation(value = "queryWorkFlowLineageByIds", notes = "QUERY_WORKFLOW_LINEAGE_BY_IDS_NOTES") @GetMapping(value = "/list-ids") @ResponseStatus(HttpStatus.OK) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result<Map<String, Object>> queryWorkFlowLineageByIds(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, @ApiParam(name = "projectId", value = "PROJECT_ID", required = true, example = "1") @PathVariable int projectId, @ApiIgnore @RequestParam(value = "ids", required = false) String ids) { try { ids = ParameterUtils.handleEscapes(ids); Set<Integer> idsSet = new HashSet<>(); if (ids != null) { String[] idsStr = ids.split(","); for (String id : idsStr) { idsSet.add(Integer.parseInt(id)); } } Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByIds(idsSet, projectId); return returnDataList(result); } catch (Exception e) { logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkFlowLineageService.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 java.util.Map; import java.util.Set; /** * work flow lineage service */ public interface WorkFlowLineageService { Map<String, Object> queryWorkFlowLineageByName(String workFlowName, int projectId); Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids,int projectId); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.WorkFlowLineageService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.ProcessLineage; import org.apache.dolphinscheduler.dao.entity.Project;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java
import org.apache.dolphinscheduler.dao.entity.WorkFlowLineage; import org.apache.dolphinscheduler.dao.entity.WorkFlowRelation; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.WorkFlowLineageMapper; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * work flow lineage service impl */ @Service public class WorkFlowLineageServiceImpl extends BaseServiceImpl implements WorkFlowLineageService { @Autowired private WorkFlowLineageMapper workFlowLineageMapper; @Autowired private ProjectMapper projectMapper; @Override public Map<String, Object> queryWorkFlowLineageByName(String workFlowName, int projectId) { Project project = projectMapper.selectById(projectId); Map<String, Object> result = new HashMap<>(); List<WorkFlowLineage> workFlowLineageList = workFlowLineageMapper.queryByName(workFlowName, project.getCode()); result.put(Constants.DATA_LIST, workFlowLineageList); putMsg(result, Status.SUCCESS); return result; } private void getRelation(Map<Integer, WorkFlowLineage> workFlowLineageMap,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java
Set<WorkFlowRelation> workFlowRelations, ProcessLineage processLineage) { List<ProcessLineage> relations = workFlowLineageMapper.queryCodeRelation( processLineage.getPostTaskCode(), processLineage.getPostTaskVersion(), processLineage.getProcessDefinitionCode(), processLineage.getProjectCode()); if (!relations.isEmpty()) { Set<Integer> preWorkFlowIds = new HashSet<>(); List<ProcessLineage> preRelations = workFlowLineageMapper.queryCodeRelation( processLineage.getPreTaskCode(), processLineage.getPreTaskVersion(), processLineage.getProcessDefinitionCode(), processLineage.getProjectCode()); for (ProcessLineage preRelation : preRelations) { WorkFlowLineage pre = workFlowLineageMapper.queryWorkFlowLineageByCode( preRelation.getProcessDefinitionCode(), preRelation.getProjectCode()); preWorkFlowIds.add(pre.getWorkFlowId()); } ProcessLineage postRelation = relations.get(0); WorkFlowLineage post = workFlowLineageMapper.queryWorkFlowLineageByCode( postRelation.getProcessDefinitionCode(), postRelation.getProjectCode()); if (!workFlowLineageMap.containsKey(post.getWorkFlowId())) { post.setSourceWorkFlowId(StringUtils.join(preWorkFlowIds, ",")); workFlowLineageMap.put(post.getWorkFlowId(), post); } else { WorkFlowLineage workFlowLineage = workFlowLineageMap.get(post.getWorkFlowId()); String sourceWorkFlowId = workFlowLineage.getSourceWorkFlowId(); if (sourceWorkFlowId.equals("")) { workFlowLineage.setSourceWorkFlowId(StringUtils.join(preWorkFlowIds, ",")); } else { if (!preWorkFlowIds.isEmpty()) { workFlowLineage.setSourceWorkFlowId(sourceWorkFlowId + "," + StringUtils.join(preWorkFlowIds, ",")); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java
} } if (preWorkFlowIds.isEmpty()) { workFlowRelations.add(new WorkFlowRelation(0, post.getWorkFlowId())); } else { for (Integer workFlowId : preWorkFlowIds) { workFlowRelations.add(new WorkFlowRelation(workFlowId, post.getWorkFlowId())); } } } } @Override public Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids, int projectId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.selectById(projectId); List<ProcessLineage> processLineages = workFlowLineageMapper.queryRelationByIds(ids, project.getCode()); Map<Integer, WorkFlowLineage> workFlowLineages = new HashMap<>(); Set<WorkFlowRelation> workFlowRelations = new HashSet<>(); for (ProcessLineage processLineage : processLineages) { getRelation(workFlowLineages, workFlowRelations, processLineage); } Map<String, Object> workFlowLists = new HashMap<>(); workFlowLists.put(Constants.WORKFLOW_LIST, workFlowLineages.values()); workFlowLists.put(Constants.WORKFLOW_RELATION_LIST, workFlowRelations); result.put(Constants.DATA_LIST, workFlowLists); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageControllerTest.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 org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.WorkFlowLineageServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.entity.Project;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageControllerTest.java
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.text.MessageFormat; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.springframework.context.ApplicationContext; /** * work flow lineage controller test */ public class WorkFlowLineageControllerTest extends AbstractControllerTest { @InjectMocks private WorkFlowLineageController workFlowLineageController; @Mock private WorkFlowLineageServiceImpl workFlowLineageService; @Before public void init() { ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class); SpringApplicationContext springApplicationContext = new SpringApplicationContext(); springApplicationContext.setApplicationContext(applicationContext); ProjectMapper projectMapper = Mockito.mock(ProjectMapper.class); Mockito.when(applicationContext.getBean(ProjectMapper.class)).thenReturn(projectMapper); Project project = new Project();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageControllerTest.java
project.setId(1); project.setCode(1L); Mockito.when(projectMapper.selectById(1)).thenReturn(project); } @Test public void testQueryWorkFlowLineageByName() { int projectId = 1; String searchVal = "test"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, 1); Mockito.when(workFlowLineageService.queryWorkFlowLineageByName(searchVal, projectId)).thenReturn(result); Result response = workFlowLineageController.queryWorkFlowLineageByName(user, projectId, searchVal); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryWorkFlowLineageByIds() { int projectId = 1; String ids = "1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, 1); Set<Integer> idSet = new HashSet<>(); idSet.add(1); Mockito.when(workFlowLineageService.queryWorkFlowLineageByIds(idSet, projectId)).thenReturn(result); Result response = workFlowLineageController.queryWorkFlowLineageByIds(user, projectId, ids); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkFlowLineageServiceTest.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.mockito.Mockito.when; import org.apache.dolphinscheduler.api.service.impl.WorkFlowLineageServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.entity.ProcessLineage; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.WorkFlowLineage; import org.apache.dolphinscheduler.dao.entity.WorkFlowRelation; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.WorkFlowLineageMapper; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkFlowLineageServiceTest.java
import java.util.List; import java.util.Map; import java.util.Set; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; /** * work flow lineage service test */ @RunWith(MockitoJUnitRunner.class) public class WorkFlowLineageServiceTest { @InjectMocks private WorkFlowLineageServiceImpl workFlowLineageService; @Mock private WorkFlowLineageMapper workFlowLineageMapper; @Mock private ProjectMapper projectMapper; /** * get mock Project * * @param projectName projectName * @return Project */ private Project getProject(String projectName) { Project project = new Project(); project.setCode(1L);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkFlowLineageServiceTest.java
project.setId(1); project.setName(projectName); project.setUserId(1); return project; } @Test public void testQueryWorkFlowLineageByName() { Project project = getProject("test"); String searchVal = "test"; when(projectMapper.selectById(1)).thenReturn(project); when(workFlowLineageMapper.queryByName(Mockito.any(), Mockito.any())).thenReturn(getWorkFlowLineages()); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByName(searchVal, 1); List<WorkFlowLineage> workFlowLineageList = (List<WorkFlowLineage>) result.get(Constants.DATA_LIST); Assert.assertTrue(workFlowLineageList.size() > 0); } @Test public void testQueryWorkFlowLineageByIds() { Set<Integer> ids = new HashSet<>(); ids.add(1); ids.add(2); Project project = getProject("test"); List<ProcessLineage> processLineages = new ArrayList<>(); ProcessLineage processLineage = new ProcessLineage(); processLineage.setPreTaskVersion(1); processLineage.setPreTaskCode(1L); processLineage.setPostTaskCode(2L); processLineage.setPostTaskVersion(1); processLineage.setProcessDefinitionCode(1111L); processLineage.setProcessDefinitionVersion(1); processLineage.setProjectCode(1111L);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,517
[Feature][JsonSplit-api]WorkFlowLineage interface
from #5498 Change the request parameter projectId to projectCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5517
https://github.com/apache/dolphinscheduler/pull/5834
741d757dcb8c80c97c32d314c0fb5da08ebad5ea
901bc9a43cc3f6f48a9681b1884a714c143759f1
"2021-05-18T14:02:08Z"
java
"2021-07-19T01:49:40Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkFlowLineageServiceTest.java
processLineages.add(processLineage); WorkFlowLineage workFlowLineage = new WorkFlowLineage(); workFlowLineage.setSourceWorkFlowId(""); when(projectMapper.selectById(1)).thenReturn(project); when(workFlowLineageMapper.queryRelationByIds(ids, project.getCode())).thenReturn(processLineages); when(workFlowLineageMapper.queryCodeRelation(processLineage.getPostTaskCode() , processLineage.getPreTaskVersion() , processLineage.getProcessDefinitionCode() , processLineage.getProjectCode())) .thenReturn(processLineages); when(workFlowLineageMapper .queryWorkFlowLineageByCode(processLineage.getProcessDefinitionCode(), processLineage.getProjectCode())) .thenReturn(workFlowLineage); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByIds(ids, 1); Map<String, Object> workFlowLists = (Map<String, Object>) result.get(Constants.DATA_LIST); Collection<WorkFlowLineage> workFlowLineages = (Collection<WorkFlowLineage>) workFlowLists.get(Constants.WORKFLOW_LIST); Set<WorkFlowRelation> workFlowRelations = (Set<WorkFlowRelation>) workFlowLists.get(Constants.WORKFLOW_RELATION_LIST); Assert.assertTrue(workFlowLineages.size() > 0); Assert.assertTrue(workFlowRelations.size() > 0); } private List<WorkFlowLineage> getWorkFlowLineages() { List<WorkFlowLineage> workFlowLineages = new ArrayList<>(); WorkFlowLineage workFlowLineage = new WorkFlowLineage(); workFlowLineage.setWorkFlowId(1); workFlowLineage.setWorkFlowName("testdag"); workFlowLineages.add(workFlowLineage); return workFlowLineages; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.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.apache.dolphinscheduler.api.enums.Status.CHECK_PROCESS_DEFINITION_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.EXECUTE_PROCESS_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.START_PROCESS_INSTANCE_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.ExecutorService;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import springfox.documentation.annotations.ApiIgnore; /** * executor controller */ @Api(tags = "EXECUTOR_TAG")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
@RestController @RequestMapping("projects/{projectName}/executors") public class ExecutorController extends BaseController { @Autowired private ExecutorService execService; /** * execute process instance * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @param scheduleTime schedule time * @param failureStrategy failure strategy * @param startNodeList start nodes list * @param taskDependType task depend type * @param execType execute type * @param warningType warning type * @param warningGroupId warning group id * @param runMode run mode * @param processInstancePriority process instance priority * @param workerGroup worker group * @param timeout timeout * @return start process result code */ @ApiOperation(value = "startProcessInstance", notes = "RUN_PROCESS_INSTANCE_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", required = true, dataType = "String"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", required = true, dataType = "FailureStrategy"), @ApiImplicitParam(name = "startNodeList", value = "START_NODE_LIST", dataType = "String"), @ApiImplicitParam(name = "taskDependType", value = "TASK_DEPEND_TYPE", dataType = "TaskDependType"), @ApiImplicitParam(name = "execType", value = "COMMAND_TYPE", dataType = "CommandType"), @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", required = true, dataType = "WarningType"), @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "runMode", value = "RUN_MODE", dataType = "RunMode"), @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", required = true, dataType = "Priority"), @ApiImplicitParam(name = "workerGroup", value = "WORKER_GROUP", dataType = "String", example = "default"), @ApiImplicitParam(name = "timeout", value = "TIMEOUT", dataType = "Int", example = "100"), }) @PostMapping(value = "start-process-instance") @ResponseStatus(HttpStatus.OK) @ApiException(START_PROCESS_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result startProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @RequestParam(value = "processDefinitionId") int processDefinitionId, @RequestParam(value = "scheduleTime", required = false) String scheduleTime, @RequestParam(value = "failureStrategy", required = true) FailureStrategy failureStrategy, @RequestParam(value = "startNodeList", required = false) String startNodeList, @RequestParam(value = "taskDependType", required = false) TaskDependType taskDependType, @RequestParam(value = "execType", required = false) CommandType execType, @RequestParam(value = "warningType", required = true) WarningType warningType, @RequestParam(value = "warningGroupId", required = false) int warningGroupId, @RequestParam(value = "runMode", required = false) RunMode runMode, @RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority, @RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup, @RequestParam(value = "timeout", required = false) Integer timeout, @RequestParam(value = "startParams", required = false) String startParams) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
if (timeout == null) { timeout = Constants.MAX_TASK_TIMEOUT; } Map<String, String> startParamMap = null; if (startParams != null) { startParamMap = JSONUtils.toMap(startParams); } Map<String, Object> result = execService.execProcessInstance(loginUser, projectName, processDefinitionId, scheduleTime, execType, failureStrategy, startNodeList, taskDependType, warningType, warningGroupId, runMode, processInstancePriority, workerGroup, timeout, startParamMap); return returnDataList(result); } /** * do action to process instance:pause, stop, repeat, recover from pause, recover from stop * * @param loginUser login user * @param projectName project name * @param processInstanceId process instance id * @param executeType execute type * @return execute result code */ @ApiOperation(value = "execute", notes = "EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "executeType", value = "EXECUTE_TYPE", required = true, dataType = "ExecuteType") }) @PostMapping(value = "/execute") @ResponseStatus(HttpStatus.OK) @ApiException(EXECUTE_PROCESS_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
public Result execute(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @RequestParam("processInstanceId") Integer processInstanceId, @RequestParam("executeType") ExecuteType executeType ) { Map<String, Object> result = execService.execute(loginUser, projectName, processInstanceId, executeType); return returnDataList(result); } /** * check process definition and all of the son process definitions is on line. * * @param loginUser login user * @param processDefinitionId process definition id * @return check result code */ @ApiOperation(value = "startCheckProcessDefinition", notes = "START_CHECK_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/start-check") @ResponseStatus(HttpStatus.OK) @ApiException(CHECK_PROCESS_DEFINITION_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result startCheckProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "processDefinitionId") int processDefinitionId) { Map<String, Object> result = execService.startCheckByProcessDefinedId(processDefinitionId); return returnDataList(result); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.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 org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * executor service */ public interface ExecutorService { /** * execute process instance * * @param loginUser login user * @param projectName project name * @param processDefinitionId process Definition Id * @param cronTime cron time * @param commandType command type * @param failureStrategy failuer strategy * @param startNodeList start nodelist * @param taskDependType node dependency type * @param warningType warning type * @param warningGroupId notify group id * @param processInstancePriority process instance priority * @param workerGroup worker group name * @param runMode run mode * @param timeout timeout * @param startParams the global param values which pass to new process instance * @return execute process instance code */ Map<String, Object> execProcessInstance(User loginUser, String projectName, int processDefinitionId, String cronTime, CommandType commandType, FailureStrategy failureStrategy, String startNodeList, TaskDependType taskDependType, WarningType warningType, int warningGroupId,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
RunMode runMode, Priority processInstancePriority, String workerGroup, Integer timeout, Map<String, String> startParams); /** * check whether the process definition can be executed * * @param processDefinition process definition * @param processDefineCode process definition code * @return check result code */ Map<String, Object> checkProcessDefinitionValid(ProcessDefinition processDefinition, long processDefineCode); /** * do action to process instance:pause, stop, repeat, recover from pause, recover from stop * * @param loginUser login user * @param projectName project name * @param processInstanceId process instance id * @param executeType execute type * @return execute result code */ Map<String, Object> execute(User loginUser, String projectName, Integer processInstanceId, ExecuteType executeType); /** * check if sub processes are offline before starting process definition * * @param processDefineId process definition id * @return check result code */ Map<String, Object> startCheckByProcessDefinedId(int processDefineId); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* * 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 static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODE_NAMES; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS; import static org.apache.dolphinscheduler.common.Constants.MAX_TASK_TIMEOUT; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.MonitorService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; 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.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.CollectionUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; 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.service.process.ProcessService; import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; import org.apache.commons.collections.MapUtils; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * executor service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorService { private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceImpl.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private MonitorService monitorService; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessService processService; /** * execute process instance * * @param loginUser login user * @param projectName project name * @param processDefinitionId process Definition Id * @param cronTime cron time * @param commandType command type * @param failureStrategy failuer strategy * @param startNodeList start nodelist * @param taskDependType node dependency type * @param warningType warning type
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @param warningGroupId notify group id * @param processInstancePriority process instance priority * @param workerGroup worker group name * @param runMode run mode * @param timeout timeout * @param startParams the global param values which pass to new process instance * @return execute process instance code */ @Override public Map<String, Object> execProcessInstance(User loginUser, String projectName, int processDefinitionId, String cronTime, CommandType commandType, FailureStrategy failureStrategy, String startNodeList, TaskDependType taskDependType, WarningType warningType, int warningGroupId, RunMode runMode, Priority processInstancePriority, String workerGroup, Integer timeout, Map<String, String> startParams) { Map<String, Object> result = new HashMap<>(); if (timeout <= 0 || timeout > MAX_TASK_TIMEOUT) { putMsg(result, Status.TASK_TIMEOUT_PARAMS_ERROR); return result; } Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResultAndAuth = checkResultAndAuth(loginUser, projectName, project); if (checkResultAndAuth != null) { return checkResultAndAuth; } ProcessDefinition processDefinition = processDefinitionMapper.selectById(processDefinitionId); result = checkProcessDefinitionValid(processDefinition, processDefinitionId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (!checkTenantSuitable(processDefinition)) { logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); return result; } if (!checkMasterExists(result)) { return result; } /** * create command */ int create = this.createCommand(commandType, processDefinitionId, taskDependType, failureStrategy, startNodeList, cronTime, warningType, loginUser.getId(), warningGroupId, runMode, processInstancePriority, workerGroup, startParams); if (create > 0) { processDefinition.setWarningGroupId(warningGroupId); processDefinitionMapper.updateById(processDefinition); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.START_PROCESS_INSTANCE_ERROR); } return result; } /** * check whether master exists
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* * @param result result * @return master exists return true , otherwise return false */ private boolean checkMasterExists(Map<String, Object> result) { List<Server> masterServers = monitorService.getServerListFromRegistry(true); if (masterServers.isEmpty()) { putMsg(result, Status.MASTER_NOT_EXISTS); return false; } return true; } /** * check whether the process definition can be executed * * @param processDefinition process definition * @param processDefineCode process definition code * @return check result code */ @Override public Map<String, Object> checkProcessDefinitionValid(ProcessDefinition processDefinition, long processDefineCode) { Map<String, Object> result = new HashMap<>(); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefineCode); } else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefineCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} else { result.put(Constants.STATUS, Status.SUCCESS); } return result; } /** * do action to process instance:pause, stop, repeat, recover from pause, recover from stop * * @param loginUser login user * @param projectName project name * @param processInstanceId process instance id * @param executeType execute type * @return execute result code */ @Override public Map<String, Object> execute(User loginUser, String projectName, Integer processInstanceId, ExecuteType executeType) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = checkResultAndAuth(loginUser, projectName, project); if (checkResult != null) { return checkResult; } if (!checkMasterExists(result)) { return result; } ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId); if (processInstance == null) { putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} ProcessDefinition processDefinition = processService.findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); if (executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE) { result = checkProcessDefinitionValid(processDefinition, processInstance.getProcessDefinitionCode()); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } } checkResult = checkExecuteType(processInstance, executeType); Status status = (Status) checkResult.get(Constants.STATUS); if (status != Status.SUCCESS) { return checkResult; } if (!checkTenantSuitable(processDefinition)) { logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); } // Map<String, Object> commandMap = JSONUtils.toMap(processInstance.getCommandParam(), String.class, Object.class); String startParams = null; if (MapUtils.isNotEmpty(commandMap) && executeType == ExecuteType.REPEAT_RUNNING) { Object startParamsJson = commandMap.get(Constants.CMD_PARAM_START_PARAMS); if (startParamsJson != null) { startParams = startParamsJson.toString(); } } switch (executeType) { case REPEAT_RUNNING:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.REPEAT_RUNNING, startParams); break; case RECOVER_SUSPENDED_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.RECOVER_SUSPENDED_PROCESS, startParams); break; case START_FAILURE_TASK_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.START_FAILURE_TASK_PROCESS, startParams); break; case STOP: if (processInstance.getState() == ExecutionStatus.READY_STOP) { putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.STOP, ExecutionStatus.READY_STOP); } break; case PAUSE: if (processInstance.getState() == ExecutionStatus.READY_PAUSE) { putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, ExecutionStatus.READY_PAUSE); } break; default: logger.error("unknown execute type : {}", executeType); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type"); break; } return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* check tenant suitable * * @param processDefinition process definition * @return true if tenant suitable, otherwise return false */ private boolean checkTenantSuitable(ProcessDefinition processDefinition) { Tenant tenant = processService.getTenantForProcess(processDefinition.getTenantId(), processDefinition.getUserId()); return tenant != null; } /** * Check the state of process instance and the type of operation match * * @param processInstance process instance * @param executeType execute type * @return check result code */ private Map<String, Object> checkExecuteType(ProcessInstance processInstance, ExecuteType executeType) { Map<String, Object> result = new HashMap<>(); ExecutionStatus executionStatus = processInstance.getState(); boolean checkResult = false; switch (executeType) { case PAUSE: case STOP: if (executionStatus.typeIsRunning()) { checkResult = true; } break; case REPEAT_RUNNING: if (executionStatus.typeIsFinished()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
checkResult = true; } break; case START_FAILURE_TASK_PROCESS: if (executionStatus.typeIsFailure()) { checkResult = true; } break; case RECOVER_SUSPENDED_PROCESS: if (executionStatus.typeIsPause() || executionStatus.typeIsCancel()) { checkResult = true; } break; default: break; } if (!checkResult) { putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), executionStatus.toString(), executeType.toString()); } else { putMsg(result, Status.SUCCESS); } return result; } /** * prepare to update process instance command type and status * * @param processInstance process instance * @param commandType command type * @param executionStatus execute status * @return update result
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
*/ private Map<String, Object> updateProcessInstancePrepare(ProcessInstance processInstance, CommandType commandType, ExecutionStatus executionStatus) { Map<String, Object> result = new HashMap<>(); processInstance.setCommandType(commandType); processInstance.addHistoryCmd(commandType); processInstance.setState(executionStatus); int update = processService.updateProcessInstance(processInstance); // if (update > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * insert command, used in the implementation of the page, re run, recovery (pause / failure) execution * * @param loginUser login user * @param instanceId instance id * @param processDefinitionId process definition id * @param commandType command type * @return insert result code */ private Map<String, Object> insertCommand(User loginUser, Integer instanceId, Integer processDefinitionId, CommandType commandType, String startParams) { Map<String, Object> result = new HashMap<>(); // Map<String, Object> cmdParam = new HashMap<>(); cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, instanceId); if (StringUtils.isNotEmpty(startParams)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
cmdParam.put(CMD_PARAM_START_PARAMS, startParams); } Command command = new Command(); command.setCommandType(commandType); command.setProcessDefinitionId(processDefinitionId); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); command.setExecutorId(loginUser.getId()); if (!processService.verifyIsNeedCreateCommand(command)) { putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND, processDefinitionId); return result; } int create = processService.createCommand(command); if (create > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * check if sub processes are offline before starting process definition * * @param processDefineId process definition id * @return check result code */ @Override public Map<String, Object> startCheckByProcessDefinedId(int processDefineId) { Map<String, Object> result = new HashMap<>(); if (processDefineId == 0) { logger.error("process definition id is null");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "process definition id"); } List<Integer> ids = new ArrayList<>(); processService.recurseFindSubProcessId(processDefineId, ids); Integer[] idArray = ids.toArray(new Integer[ids.size()]); if (!ids.isEmpty()) { List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryDefinitionListByIdList(idArray); if (processDefinitionList != null) { for (ProcessDefinition processDefinition : processDefinitionList) { /** * if there is no online process, exit directly */ if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefinition.getName()); logger.info("not release process definition id: {} , name : {}", processDefinition.getId(), processDefinition.getName()); return result; } } } } putMsg(result, Status.SUCCESS); return result; } /** * create command * * @param commandType commandType * @param processDefineId processDefineId * @param nodeDep nodeDep
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @param failureStrategy failureStrategy * @param startNodeList startNodeList * @param schedule schedule * @param warningType warningType * @param executorId executorId * @param warningGroupId warningGroupId * @param runMode runMode * @param processInstancePriority processInstancePriority * @param workerGroup workerGroup * @return command id */ private int createCommand(CommandType commandType, int processDefineId, TaskDependType nodeDep, FailureStrategy failureStrategy, String startNodeList, String schedule, WarningType warningType, int executorId, int warningGroupId, RunMode runMode, Priority processInstancePriority, String workerGroup, Map<String, String> startParams) { /** * instantiate command schedule instance */ Command command = new Command(); Map<String, String> cmdParam = new HashMap<>(); if (commandType == null) { command.setCommandType(CommandType.START_PROCESS); } else { command.setCommandType(commandType); } command.setProcessDefinitionId(processDefineId); if (nodeDep != null) { command.setTaskDependType(nodeDep);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} if (failureStrategy != null) { command.setFailureStrategy(failureStrategy); } if (StringUtils.isNotEmpty(startNodeList)) { cmdParam.put(CMD_PARAM_START_NODE_NAMES, startNodeList); } if (warningType != null) { command.setWarningType(warningType); } if (startParams != null && startParams.size() > 0) { cmdParam.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams)); } command.setCommandParam(JSONUtils.toJsonString(cmdParam)); command.setExecutorId(executorId); command.setWarningGroupId(warningGroupId); command.setProcessInstancePriority(processInstancePriority); command.setWorkerGroup(workerGroup); Date start = null; Date end = null; if (StringUtils.isNotEmpty(schedule)) { String[] interval = schedule.split(","); if (interval.length == 2) { start = DateUtils.getScheduleDate(interval[0]); end = DateUtils.getScheduleDate(interval[1]); } } // if (commandType == CommandType.COMPLEMENT_DATA) { runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (null != start && null != end && !start.after(end)) { if (runMode == RunMode.RUN_MODE_SERIAL) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(end)); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); return processService.createCommand(command); } else if (runMode == RunMode.RUN_MODE_PARALLEL) { List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionId(processDefineId); List<Date> listDate = new LinkedList<>(); if (!CollectionUtils.isEmpty(schedules)) { for (Schedule item : schedules) { listDate.addAll(CronUtils.getSelfFireDateList(start, end, item.getCrontab())); } } if (!CollectionUtils.isEmpty(listDate)) { // for (Date date : listDate) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(date)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(date)); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); } return listDate.size(); } else { // int runCunt = 0; while (!start.after(end)) { runCunt += 1; cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(start));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); start = DateUtils.getSomeDay(start, 1); } return runCunt; } } } else { logger.error("there is not valid schedule date for the process definition: id:{}", processDefineId); } } else { command.setCommandParam(JSONUtils.toJsonString(cmdParam)); return processService.createCommand(command); } return 0; } /** * check result and auth */ private Map<String, Object> checkResultAndAuth(User loginUser, String projectName, Project project) { // Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status status = (Status) checkResult.get(Constants.STATUS); if (status != Status.SUCCESS) { return checkResult; } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ExecutorControllerTest.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ExecutorControllerTest.java
* * 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.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; 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.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * executor controller test */ public class ExecutorControllerTest extends AbstractControllerTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ExecutorControllerTest.java
private static Logger logger = LoggerFactory.getLogger(ExecutorControllerTest.class); @Ignore @Test public void testStartProcessInstance() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("processDefinitionId", "40"); paramsMap.add("scheduleTime", ""); paramsMap.add("failureStrategy", String.valueOf(FailureStrategy.CONTINUE)); paramsMap.add("startNodeList", ""); paramsMap.add("taskDependType", ""); paramsMap.add("execType", ""); paramsMap.add("warningType", String.valueOf(WarningType.NONE)); paramsMap.add("warningGroupId", ""); paramsMap.add("receivers", ""); paramsMap.add("receiversCc", ""); paramsMap.add("runMode", ""); paramsMap.add("processInstancePriority", ""); paramsMap.add("workerGroupId", ""); paramsMap.add("timeout", ""); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/executors/start-process-instance", "cxc_1113") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .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
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ExecutorControllerTest.java
@Ignore @Test public void testExecute() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("processInstanceId", "40"); paramsMap.add("executeType", String.valueOf(ExecuteType.NONE)); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/executors/execute", "cxc_1113") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .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 testStartCheckProcessDefinition() throws Exception { MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/executors/start-check", "cxc_1113") .header(SESSION_ID, sessionId) .param("processDefinitionId", "40")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .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
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.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.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ExecutorServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; 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.mockito.junit.MockitoJUnitRunner; /** * executor service 2 test */ @RunWith(MockitoJUnitRunner.Silent.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
public class ExecutorService2Test { @InjectMocks private ExecutorServiceImpl executorService; @Mock private ProcessService processService; @Mock private ProcessDefinitionMapper processDefinitionMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Mock private MonitorService monitorService; private int processDefinitionId = 1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
private int processInstanceId = 1; private int tenantId = 1; private int userId = 1; private ProcessDefinition processDefinition = new ProcessDefinition(); private ProcessInstance processInstance = new ProcessInstance(); private User loginUser = new User(); private String projectName = "projectName"; private Project project = new Project(); private String cronTime; @Before public void init() { loginUser.setId(userId); processDefinition.setId(processDefinitionId); processDefinition.setReleaseState(ReleaseState.ONLINE); processDefinition.setTenantId(tenantId); processDefinition.setUserId(userId); processDefinition.setVersion(1); processDefinition.setCode(1L); processInstance.setId(processInstanceId); processInstance.setState(ExecutionStatus.FAILURE); processInstance.setExecutorId(userId); processInstance.setTenantId(tenantId); processInstance.setProcessDefinitionVersion(1); processInstance.setProcessDefinitionCode(1L); project.setName(projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
cronTime = "2020-01-01 00:00:00,2020-01-31 23:00:00"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(checkProjectAndAuth()); Mockito.when(processDefinitionMapper.selectById(processDefinitionId)).thenReturn(processDefinition); Mockito.when(processService.getTenantForProcess(tenantId, userId)).thenReturn(new Tenant()); Mockito.when(processService.createCommand(any(Command.class))).thenReturn(1); Mockito.when(monitorService.getServerListFromRegistry(true)).thenReturn(getMasterServersList()); Mockito.when(processService.findProcessInstanceDetailById(processInstanceId)).thenReturn(processInstance); Mockito.when(processService.findProcessDefinition(1L, 1)).thenReturn(processDefinition); } /** * not complement */ @Test public void testNoComplement() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId)).thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectName, processDefinitionId, cronTime, CommandType.START_PROCESS, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 110, null); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(1)).createCommand(any(Command.class)); } /** * not complement */ @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
public void testComplementWithStartNodeList() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId)).thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectName, processDefinitionId, cronTime, CommandType.START_PROCESS, null, "n1,n2", null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 110, null); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(1)).createCommand(any(Command.class)); } /** * date error */ @Test public void testDateError() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId)).thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectName, processDefinitionId, "2020-01-31 23:00:00,2020-01-01 00:00:00", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 110, null); Assert.assertEquals(Status.START_PROCESS_INSTANCE_ERROR, result.get(Constants.STATUS)); verify(processService, times(0)).createCommand(any(Command.class)); } /** * serial */ @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,519
[Feature][JsonSplit-api]executors interface
from #5498 Change the request parameter processDefinitionId to processDefinitionCode,including the front end and controller interface
https://github.com/apache/dolphinscheduler/issues/5519
https://github.com/apache/dolphinscheduler/pull/5863
8f0c400ee094e9f93fd74e9d09f6258903f56d91
c5bc4fc48e67d3e8e1b40157403c8c4017ffae57
"2021-05-18T14:03:18Z"
java
"2021-07-20T09:22:10Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
public void testSerial() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId)).thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectName, processDefinitionId, cronTime, CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 110, null); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(1)).createCommand(any(Command.class)); } /** * without schedule */ @Test public void testParallelWithOutSchedule() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId)).thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectName, processDefinitionId, cronTime, CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_PARALLEL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 110, null); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(31)).createCommand(any(Command.class)); } /** * with schedule */ @Test