status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,619 | [Improvement] [Master] MDC Logging causing OutOfMemory with TaskRecallProcessor [TaskRecallProcessor#process(Channel channel, Command command)] | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In the process method of the TaskRecallProcessor, add WorkflowInstanceId 、TaskInstanceId to MDC Context, but only remove WorkflowInstanceId
`
try {
LoggerUtils.setWorkflowAndTaskInstanceIDMDC(cmd.getProcessInstanceId(),cmd.getTaskInstanceId());
//........
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
`
### Use case
No response
### Related issues
No response
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10619 | https://github.com/apache/dolphinscheduler/pull/10620 | 16144a8858ab538be797f93abaaef8f291878eff | 628c8ab2a144a4d49d60f02a08e7cdc1672970de | 2022-06-25T17:45:27Z | java | 2022-06-26T02:07:35Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskRecallProcessor.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.master.processor;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.command.TaskRecallCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.server.master.processor.queue.TaskEvent;
import org.apache.dolphinscheduler.server.master.processor.queue.TaskEventService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Preconditions; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,619 | [Improvement] [Master] MDC Logging causing OutOfMemory with TaskRecallProcessor [TaskRecallProcessor#process(Channel channel, Command command)] | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In the process method of the TaskRecallProcessor, add WorkflowInstanceId 、TaskInstanceId to MDC Context, but only remove WorkflowInstanceId
`
try {
LoggerUtils.setWorkflowAndTaskInstanceIDMDC(cmd.getProcessInstanceId(),cmd.getTaskInstanceId());
//........
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
`
### Use case
No response
### Related issues
No response
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10619 | https://github.com/apache/dolphinscheduler/pull/10620 | 16144a8858ab538be797f93abaaef8f291878eff | 628c8ab2a144a4d49d60f02a08e7cdc1672970de | 2022-06-25T17:45:27Z | java | 2022-06-26T02:07:35Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskRecallProcessor.java | import io.netty.channel.Channel;
/**
* task recall processor
*/
@Component
public class TaskRecallProcessor implements NettyRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(TaskRecallProcessor.class);
@Autowired
private TaskEventService taskEventService;
/**
* task ack process
*
* @param channel channel channel
* @param command command TaskExecuteAckCommand
*/
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.TASK_RECALL == command.getType(), String.format("invalid command type : %s", command.getType()));
TaskRecallCommand recallCommand = JSONUtils.parseObject(command.getBody(), TaskRecallCommand.class);
TaskEvent taskEvent = TaskEvent.newRecallEvent(recallCommand, channel);
try {
LoggerUtils.setWorkflowAndTaskInstanceIDMDC(recallCommand.getProcessInstanceId(), recallCommand.getTaskInstanceId());
logger.info("Receive task recall command: {}", recallCommand);
taskEventService.addEvent(taskEvent);
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.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.spi.utils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | import static java.nio.charset.StandardCharsets.UTF_8;
import static com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL;
import static com.fasterxml.jackson.databind.MapperFeature.REQUIRE_SETTERS_FOR_GETTERS;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import com.fasterxml.jackson.databind.type.CollectionType;
/**
* json utils
*/
public class JSONUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class);
static {
logger.info("init timezone: {}",TimeZone.getDefault());
}
/**
* can use static singleton, inject: just make sure to reuse!
*/
private static final ObjectMapper objectMapper = new ObjectMapper()
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true)
.configure(READ_UNKNOWN_ENUM_VALUES_AS_NULL, true)
.configure(REQUIRE_SETTERS_FOR_GETTERS, true)
.setTimeZone(TimeZone.getDefault())
.setDateFormat(new SimpleDateFormat(Constants.YYYY_MM_DD_HH_MM_SS));
private JSONUtils() {
throw new UnsupportedOperationException("Construct JSONUtils");
}
public static ArrayNode createArrayNode() {
return objectMapper.createArrayNode();
}
public static ObjectNode createObjectNode() {
return objectMapper.createObjectNode();
}
public static JsonNode toJsonNode(Object obj) {
return objectMapper.valueToTree(obj);
}
/**
* json representation of object
*
* @param object object |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | * @param feature feature
* @return object to json string
*/
public static String toJsonString(Object object, SerializationFeature feature) {
try {
ObjectWriter writer = objectMapper.writer(feature);
return writer.writeValueAsString(object);
} catch (Exception e) {
logger.error("object to json exception!", e);
}
return null;
}
/**
* This method deserializes the specified Json into an object of the specified class. It is not
* suitable to use if the specified class is a generic type since it will not have the generic
* type information because of the Type Erasure feature of Java. Therefore, this method should not
* be used if the desired type is a generic type. Note that this method works fine if the any of
* the fields of the specified object are generics, just the object itself should not be a
* generic type.
*
* @param json the string from which the object is to be deserialized
* @param clazz the class of T
* @param <T> T
* @return an object of type T from the string
* classOfT
*/
public static <T> T parseObject(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
logger.error("parse object exception!", e);
}
return null;
}
/**
* deserialize
*
* @param src byte array
* @param clazz class
* @param <T> deserialize type
* @return deserialize type
*/
public static <T> T parseObject(byte[] src, Class<T> clazz) {
if (src == null) {
return null;
}
String json = new String(src, UTF_8);
return parseObject(json, clazz);
}
/**
* json to list
*
* @param json json string
* @param clazz class
* @param <T> T
* @return list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | public static <T> List<T> toList(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
return Collections.emptyList();
}
try {
CollectionType listType = objectMapper.getTypeFactory().constructCollectionType(ArrayList.class, clazz);
return objectMapper.readValue(json, listType);
} catch (Exception e) {
logger.error("parse list exception!", e);
}
return Collections.emptyList();
}
/**
* json to map
* {@link #toMap(String, Class, Class)}
*
* @param json json
* @return json to map
*/
public static Map<String, String> toMap(String json) {
return parseObject(json, new TypeReference<Map<String, String>>() {});
}
/**
* json to map
*
* @param json json
* @param classK classK
* @param classV classV
* @param <K> K
* @param <V> V |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | * @return to map
*/
public static <K, V> Map<K, V> toMap(String json, Class<K> classK, Class<V> classV) {
return parseObject(json, new TypeReference<Map<K, V>>() {});
}
/**
* json to object
*
* @param json json string
* @param type type reference
* @param <T>
* @return return parse object
*/
public static <T> T parseObject(String json, TypeReference<T> type) {
if (StringUtils.isEmpty(json)) {
return null;
}
try {
return objectMapper.readValue(json, type);
} catch (Exception e) {
logger.error("json to map exception!", e);
}
return null;
}
/**
* object to json string
*
* @param object object
* @return json string
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | public static String toJsonString(Object object) {
try {
return objectMapper.writeValueAsString(object);
} catch (Exception e) {
throw new RuntimeException("Object json deserialization exception.", e);
}
}
/**
* serialize to json byte
*
* @param obj object
* @param <T> object type
* @return byte array
*/
public static <T> byte[] toJsonByteArray(T obj) {
if (obj == null) {
return null;
}
String json = "";
try {
json = toJsonString(obj);
} catch (Exception e) {
logger.error("json serialize exception.", e);
}
return json.getBytes(UTF_8);
}
public static ObjectNode parseObject(String text) {
try {
if (text.isEmpty()) {
return parseObject(text, ObjectNode.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,403 | [Bug] [dolphinscheduler-spi] JSONUtils parse LocalDateTime error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When I try to set Custom Parameters of SQL Task Node with OUT type, I get such error msg:
```
[ERROR] 2022-06-10 09:32:40.206 +0000 org.apache.dolphinscheduler.spi.utils.JSONUtils:[215] - json to map exception!
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (String)"{"id":1,"code":5791423019648,"name":"cat","version":1,"description":"","project_code":5791415412992,"release_state":1,"user_id":1,"global_params":"[]","flag":1,"locations":"[{\"taskCode\":5791416706432,\"x\":-5.5,\"y\":147.5}]","warning_group_id":null,"timeout":0,"tenant_id":-1,"execution_type":0,"create_time":{},"update_time":{}}"; line: 1, column: 313] (through reference chain: java.util.LinkedHashMap["create_time"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1445)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1219)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1129)
```
In msg, `create_time` had wrong value `{}`. Thought debug, I found sql task Convert datatime to LocalDateTime. And then, JSONUtils parse this LocalDateTime object to `{}`.
I write test case, this situation is reproduced:
```
@Test
public void localDateTimeToString() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
String time = "2022-02-22 13:38:24";
Date date = DateUtils.stringToDate(time);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
String json = JSONUtils.toJsonString(localDateTime);
// console print: {}
System.out.println(json);
Assert.assertEquals(json, "\"" + time + "\"");
}
```
### What you expected to happen
JSONUtils parse LocalDateTime object to correct value.
### How to reproduce
Run the above test case.
### Anything else
_No response_
### Version
3.0.0-beta-1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10403 | https://github.com/apache/dolphinscheduler/pull/10440 | 719a9d4532733c0d7b4a54ed52b15dca7982ca8d | dafed572d17cd08dae1c1decf389f0dd4241fdf7 | 2022-06-10T10:38:07Z | java | 2022-06-27T02:19:28Z | dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java | } else {
return (ObjectNode) objectMapper.readTree(text);
}
} catch (Exception e) {
throw new RuntimeException("String json deserialization exception.", e);
}
}
public static ArrayNode parseArray(String text) {
try {
return (ArrayNode) objectMapper.readTree(text);
} catch (Exception e) {
throw new RuntimeException("Json deserialization exception.", e);
}
}
/**
* json data deserializer
*/
public static class JsonDataDeserializer extends JsonDeserializer<String> {
@Override
public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
JsonNode node = p.getCodec().readTree(p);
if (node instanceof TextNode) {
return node.asText();
} else {
return node.toString();
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | 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 static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
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.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.DependentProcessDefinition; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | import org.apache.dolphinscheduler.dao.entity.ProcessLineage;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
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.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkFlowLineageMapper;
import org.apache.dolphinscheduler.plugin.task.api.model.DependentItem;
import org.apache.dolphinscheduler.plugin.task.api.model.DependentTaskModel;
import org.apache.dolphinscheduler.plugin.task.api.parameters.DependentParameters;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | @Autowired
private ProjectMapper projectMapper;
@Autowired
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Override
public Map<String, Object> queryWorkFlowLineageByName(long projectCode, String workFlowName) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
if (project == null) {
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
return result;
}
List<WorkFlowLineage> workFlowLineageList = workFlowLineageMapper.queryWorkFlowLineageByName(projectCode, workFlowName);
result.put(Constants.DATA_LIST, workFlowLineageList);
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public Map<String, Object> queryWorkFlowLineageByCode(long projectCode, long sourceWorkFlowCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
if (project == null) {
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
return result;
}
List<WorkFlowLineage> workFlowLineages = new ArrayList<>();
Set<WorkFlowRelation> workFlowRelations = new HashSet<>();
recursiveWorkFlow(projectCode, sourceWorkFlowCode, workFlowLineages, workFlowRelations);
Map<String, Object> workFlowLists = new HashMap<>();
workFlowLists.put(Constants.WORKFLOW_LIST, workFlowLineages); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | workFlowLists.put(Constants.WORKFLOW_RELATION_LIST, workFlowRelations);
result.put(Constants.DATA_LIST, workFlowLists);
putMsg(result, Status.SUCCESS);
return result;
}
private void recursiveWorkFlow(long projectCode,
long sourceWorkFlowCode,
List<WorkFlowLineage> workFlowLineages,
Set<WorkFlowRelation> workFlowRelations) {
workFlowLineages.add(workFlowLineageMapper.queryWorkFlowLineageByCode(projectCode,sourceWorkFlowCode));
List<WorkFlowLineage> downStreamWorkFlowLineages =
workFlowLineageMapper.queryDownstreamLineageByProcessDefinitionCode(sourceWorkFlowCode, "DEPENDENT");
workFlowLineages.addAll(downStreamWorkFlowLineages);
downStreamWorkFlowLineages.forEach(workFlowLineage -> workFlowRelations.add(new WorkFlowRelation(sourceWorkFlowCode, workFlowLineage.getWorkFlowCode())));
List<WorkFlowLineage> upstreamWorkFlowLineages = new ArrayList<>();
getUpstreamLineages(sourceWorkFlowCode, upstreamWorkFlowLineages);
workFlowLineages.addAll(upstreamWorkFlowLineages);
upstreamWorkFlowLineages.forEach(workFlowLineage -> workFlowRelations.add(new WorkFlowRelation(workFlowLineage.getWorkFlowCode(), sourceWorkFlowCode)));
}
private void getUpstreamLineages(long sourceWorkFlowCode,
List<WorkFlowLineage> upstreamWorkFlowLineages) {
List<DependentProcessDefinition> workFlowDependentDefinitionList =
workFlowLineageMapper.queryUpstreamDependentParamsByProcessDefinitionCode(sourceWorkFlowCode, "DEPENDENT");
List<Long> upstreamProcessDefinitionCodes = new ArrayList<>();
getProcessDefinitionCodeByDependentDefinitionList(workFlowDependentDefinitionList,
upstreamProcessDefinitionCodes);
if (!upstreamProcessDefinitionCodes.isEmpty()) {
upstreamWorkFlowLineages.addAll(
workFlowLineageMapper.queryWorkFlowLineageByProcessDefinitionCodes(upstreamProcessDefinitionCodes));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | }
/**
* get dependent process definition code by dependent process definition list
*/
private void getProcessDefinitionCodeByDependentDefinitionList(List<DependentProcessDefinition> dependentDefinitionList,
List<Long> processDefinitionCodes) {
for (DependentProcessDefinition dependentProcessDefinition : dependentDefinitionList) {
for (DependentTaskModel dependentTaskModel : dependentProcessDefinition.getDependentParameters().getDependTaskList()) {
for (DependentItem dependentItem : dependentTaskModel.getDependItemList()) {
if (!processDefinitionCodes.contains(dependentItem.getDefinitionCode())) {
processDefinitionCodes.add(dependentItem.getDefinitionCode());
}
}
}
}
}
@Override
public Map<String, Object> queryWorkFlowLineage(long projectCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
if (project == null) {
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
return result;
}
List<ProcessLineage> processLineages = workFlowLineageMapper.queryProcessLineage(projectCode);
Map<Long, WorkFlowLineage> workFlowLineagesMap = new HashMap<>();
Set<WorkFlowRelation> workFlowRelations = new HashSet<>();
if (!processLineages.isEmpty()) {
List<WorkFlowLineage> workFlowLineages = workFlowLineageMapper.queryWorkFlowLineageByLineage(processLineages);
workFlowLineagesMap = workFlowLineages.stream().collect(Collectors.toMap(WorkFlowLineage::getWorkFlowCode, workFlowLineage -> workFlowLineage)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | Map<Long, List<TaskDefinition>> workFlowMap = new HashMap<>();
for (ProcessLineage processLineage : processLineages) {
workFlowMap.compute(processLineage.getProcessDefinitionCode(), (k, v) -> {
if (v == null) {
v = new ArrayList<>();
}
if (processLineage.getPreTaskCode() > 0) {
v.add(new TaskDefinition(processLineage.getPreTaskCode(), processLineage.getPreTaskVersion()));
}
if (processLineage.getPostTaskCode() > 0) {
v.add(new TaskDefinition(processLineage.getPostTaskCode(), processLineage.getPostTaskVersion()));
}
return v;
});
}
for (Entry<Long, List<TaskDefinition>> workFlow : workFlowMap.entrySet()) {
Set<Long> sourceWorkFlowCodes = querySourceWorkFlowCodes(projectCode, workFlow.getKey(), workFlow.getValue());
if (sourceWorkFlowCodes.isEmpty()) {
workFlowRelations.add(new WorkFlowRelation(0L, workFlow.getKey()));
} else {
workFlowLineagesMap.get(workFlow.getKey()).setSourceWorkFlowCode(StringUtils.join(sourceWorkFlowCodes, Constants.COMMA));
sourceWorkFlowCodes.forEach(code -> workFlowRelations.add(new WorkFlowRelation(code, workFlow.getKey())));
}
}
}
Map<String, Object> workFlowLists = new HashMap<>();
workFlowLists.put(Constants.WORKFLOW_LIST, workFlowLineagesMap.values());
workFlowLists.put(Constants.WORKFLOW_RELATION_LIST, workFlowRelations);
result.put(Constants.DATA_LIST, workFlowLists);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,596 | [Bug] [Api] Workflow relationship cannot be displayed normally | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
3.Unable to present workflow relationship
### What you expected to happen
{"code":10161,"msg":"查询血缘失败","data":null,"failed":true,"success":false}
### How to reproduce
1.Workflow add a dependency node without setting dependency and save
2.View project workflow relationships
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10596 | https://github.com/apache/dolphinscheduler/pull/10625 | a14b96b09143ab52a54683def740295a873bb5ad | 56d3db030640881e8cf5e0c93ce25a540580b08d | 2022-06-24T09:41:36Z | java | 2022-06-27T09:26:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkFlowLineageServiceImpl.java | return result;
}
private Set<Long> querySourceWorkFlowCodes(long projectCode, long workFlowCode, List<TaskDefinition> taskDefinitionList) {
Set<Long> sourceWorkFlowCodes = new HashSet<>();
if (taskDefinitionList == null || taskDefinitionList.isEmpty()) {
return sourceWorkFlowCodes;
}
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionList);
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (taskDefinitionLog.getProjectCode() == projectCode) {
if (taskDefinitionLog.getTaskType().equals(TASK_TYPE_DEPENDENT)) {
DependentParameters dependentParameters = JSONUtils.parseObject(taskDefinitionLog.getDependence(), DependentParameters.class);
if (dependentParameters != null) {
List<DependentTaskModel> dependTaskList = dependentParameters.getDependTaskList();
for (DependentTaskModel taskModel : dependTaskList) {
List<DependentItem> dependItemList = taskModel.getDependItemList();
for (DependentItem dependentItem : dependItemList) {
if (dependentItem.getProjectCode() == projectCode && dependentItem.getDefinitionCode() != workFlowCode) {
sourceWorkFlowCodes.add(dependentItem.getDefinitionCode());
}
}
}
}
}
}
}
return sourceWorkFlowCodes;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.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 java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.dolphinscheduler.api.dto.DagDataSchedule;
import org.apache.dolphinscheduler.api.dto.ScheduleParam;
import org.apache.dolphinscheduler.api.dto.treeview.Instance;
import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto;
import org.apache.dolphinscheduler.api.enums.Status; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.FileUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_LIST;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_BATCH_COPY;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_EXPORT;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_EXPORT;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_IMPORT;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_ONLINE_OFFLINE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE;
import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP;
import static org.apache.dolphinscheduler.common.Constants.EMPTY_STRING;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMPLEX_TASK_TYPES;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SQL;
/**
* process definition service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProcessService processService;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | private SchedulerService schedulerService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private TaskPluginManager taskPluginManager;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
String locations, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, locations, timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson);
}
protected Map<String, Object> createDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(),
insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
}
saveOtherRelation(loginUser, processDefinition, result, otherParamsJson);
return result;
}
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (taskDefinitionLogs.isEmpty()) {
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson);
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | .taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
logger.error("task relation list is null");
putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson);
return result;
}
List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream()
.map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class))
.collect(Collectors.toList());
List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
if (CollectionUtils.isNotEmpty(codes)) {
logger.error("the task code is not exist");
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, org.apache.commons.lang.StringUtils.join(codes, Constants.COMMA));
return result;
}
}
if (graphHasCycle(taskNodeList)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("the post_task_code or post_task_version can't be zero");
putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR);
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* query process definition list
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return definition simple list
*/
@Override
public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
ArrayNode arrayNode = JSONUtils.createArrayNode();
for (ProcessDefinition processDefinition : processDefinitions) {
ObjectNode processDefinitionNode = JSONUtils.createObjectNode();
processDefinitionNode.put("id", processDefinition.getId());
processDefinitionNode.put("code", processDefinition.getCode());
processDefinitionNode.put("name", processDefinition.getName());
processDefinitionNode.put("projectCode", processDefinition.getProjectCode());
arrayNode.add(processDefinitionNode);
}
result.put(Constants.DATA_LIST, arrayNode);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return process definition page
*/
@Override
public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, String otherParamsJson, Integer userId, Integer pageNo, Integer pageSize) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging(
page, searchVal, userId, project.getCode(), isAdmin(loginUser));
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query detail of process definition
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return update result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId);
processDefinition.setExecutionType(executionType);
return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs, otherParamsJson);
}
protected Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs,
String otherParamsJson) {
Map<String, Object> result = new HashMap<>();
int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
logger.info("The task has not changed, so skip");
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
boolean isChange = false;
if (processDefinition.equals(processDefinitionDeepCopy) && saveTaskResult == Constants.EXIT_CODE_SUCCESS) {
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
if (taskRelationList.size() == processTaskRelationLogList.size()) {
Set<ProcessTaskRelationLog> taskRelationSet = taskRelationList.stream().collect(Collectors.toSet());
Set<ProcessTaskRelationLog> processTaskRelationLogSet = processTaskRelationLogList.stream().collect(Collectors.toSet());
if (taskRelationSet.size() == processTaskRelationLogSet.size()) {
taskRelationSet.removeAll(processTaskRelationLogSet);
if (!taskRelationSet.isEmpty()) {
isChange = true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
} else {
isChange = true;
}
} else {
isChange = true;
}
} else {
isChange = true;
}
if (isChange) {
processDefinition.setUpdateTime(new Date());
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion <= 0) {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
saveOtherRelation(loginUser, processDefinition, result, otherParamsJson);
} else {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
return result;
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectCode project code
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim());
}
return result;
}
/**
* delete process definition by code
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinition.getName());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size());
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj != null) {
if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) {
int delete = scheduleMapper.deleteById(scheduleObj.getId());
if (delete == 0) {
putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
}
}
if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId());
return result;
}
}
int delete = processDefinitionMapper.deleteById(processDefinition.getId());
if (delete == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode());
if (deleteRelation == 0) {
logger.warn("The process definition has not relation, it will be delete successfully");
}
deleteOtherRelation(project, result, processDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
return result;
}
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) {
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code);
if (updateProcess > 0 && schedule != null) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, schedule.getId(), code);
schedule.setReleaseState(releaseState);
int updateSchedule = scheduleMapper.updateById(schedule);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), schedule.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by codes
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) {
if (org.apache.commons.lang.StringUtils.isEmpty(codes)) {
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION_EXPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
return;
}
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream().filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList());
List<DagDataSchedule> dagDataSchedules = processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(dagDataSchedules)) {
downloadProcessDefinitionFile(response, dagDataSchedules);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* download the process definition file
*/
protected void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
}
/**
* get export process dag data
*
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (scheduleObj != null) {
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(scheduleObj);
}
return dagDataSchedule;
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String dagDataScheduleJson = FileUtils.file2String(file); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_EXPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (CollectionUtils.isEmpty(dagDataScheduleList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule, EMPTY_STRING)) {
return result;
}
}
return result;
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_IMPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename();
int index = processDefinitionName.lastIndexOf(".");
if (index > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinitionName = processDefinitionName.substring(0, index);
}
processDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp();
ProcessDefinition processDefinition;
List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>();
List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>();
final int THRESHOLD_ENTRIES = 10000;
final int THRESHOLD_SIZE = 1000000000;
final double THRESHOLD_RATIO = 10;
int totalEntryArchive = 0;
int totalSizeEntry = 0;
Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Map<String, Long> taskNameToCode = new HashMap<>(16);
Map<String, List<String>> taskNameToUpstream = new HashMap<>(16);
try (ZipInputStream zIn = new ZipInputStream(file.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) {
processDefinition = new ProcessDefinition(projectCode,
processDefinitionName,
CodeGenerateUtils.getInstance().genCode(),
"",
"[]", null,
0, loginUser.getId(), loginUser.getTenantId());
ZipEntry entry;
while ((entry = zIn.getNextEntry()) != null) {
totalEntryArchive++;
int totalSizeArchive = 0;
if (!entry.isDirectory()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | StringBuilder sql = new StringBuilder();
String taskName = null;
String datasourceName = null;
List<String> upstreams = Collections.emptyList();
String line;
while ((line = bufferedReader.readLine()) != null) {
int nBytes = line.getBytes(StandardCharsets.UTF_8).length;
totalSizeEntry += nBytes;
totalSizeArchive += nBytes;
long compressionRatio = totalSizeEntry / entry.getCompressedSize();
if (compressionRatio > THRESHOLD_RATIO) {
throw new IllegalStateException("ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack");
}
int commentIndex = line.indexOf("-- ");
if (commentIndex >= 0) {
int colonIndex = line.indexOf(":", commentIndex);
if (colonIndex > 0) {
String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase();
String value = line.substring(colonIndex + 1).trim();
switch (key) {
case "name":
taskName = value;
line = line.substring(0, commentIndex);
break;
case "upstream":
upstreams = Arrays.stream(value.split(",")).map(String::trim)
.filter(s -> !"".equals(s)).collect(Collectors.toList());
line = line.substring(0, commentIndex);
break;
case "datasource": |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | datasourceName = value;
line = line.substring(0, commentIndex);
break;
default:
break;
}
}
}
if (!"".equals(line)) {
sql.append(line).append("\n");
}
}
if (taskName == null) {
taskName = entry.getName();
index = taskName.indexOf("/");
if (index > 0) {
taskName = taskName.substring(index + 1);
}
index = taskName.lastIndexOf(".");
if (index > 0) {
taskName = taskName.substring(0, index);
}
}
DataSource dataSource = dataSourceCache.get(datasourceName);
if (dataSource == null) {
dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser);
}
if (dataSource == null) {
putMsg(result, Status.DATASOURCE_NAME_ILLEGAL); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
dataSourceCache.put(datasourceName, dataSource);
TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1));
taskDefinitionList.add(taskDefinition);
taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode());
taskNameToUpstream.put(taskDefinition.getName(), upstreams);
}
if (totalSizeArchive > THRESHOLD_SIZE) {
throw new IllegalStateException("the uncompressed data size is too much for the application resource capacity");
}
if (totalEntryArchive > THRESHOLD_ENTRIES) {
throw new IllegalStateException("too much entries in this archive, can lead to inodes exhaustion of the system");
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return result;
}
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) {
List<String> upstreams = taskNameToUpstream.get(entry.getKey());
if (CollectionUtils.isEmpty(upstreams)
|| (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue());
processTaskRelationList.add(processTaskRelation);
continue;
}
for (String upstream : upstreams) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue());
processTaskRelationList.add(processTaskRelation);
}
}
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING);
}
private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) {
ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog();
processTaskRelation.setPreTaskCode(preTaskCode);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPostTaskCode(postTaskCode);
processTaskRelation.setPostTaskVersion(0);
processTaskRelation.setConditionType(ConditionType.NONE);
processTaskRelation.setName("");
return processTaskRelation;
}
private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) {
if (isAdmin(loginUser)) {
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
if (CollectionUtils.isNotEmpty(dataSources)) {
return dataSources.get(0);
}
} else {
return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName);
}
return null;
}
private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException {
TaskDefinitionLog taskDefinition = new TaskDefinitionLog();
taskDefinition.setName(taskName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskDefinition.setFlag(Flag.YES);
SqlParameters sqlParameters = new SqlParameters();
sqlParameters.setType(dataSource.getType().name());
sqlParameters.setDatasource(dataSource.getId());
sqlParameters.setSql(sql.substring(0, sql.length() - 1));
sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal());
sqlParameters.setLocalParams(Collections.emptyList());
taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters));
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
taskDefinition.setTaskType(TASK_TYPE_SQL);
taskDefinition.setFailRetryTimes(0);
taskDefinition.setFailRetryInterval(0);
taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE);
taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP);
taskDefinition.setTaskPriority(Priority.MEDIUM);
taskDefinition.setEnvironmentCode(-1);
taskDefinition.setTimeout(0);
taskDefinition.setDelayTime(0);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setVersion(0);
taskDefinition.setResourceIds("");
return taskDefinition;
}
/**
* check and import
*/
protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
String importProcessDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp();
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName);
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
processDefinition.setName(importProcessDefinitionName);
processDefinition.setId(0);
processDefinition.setProjectCode(projectCode);
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
taskDefinitionLog.setOperateTime(now);
try {
long code = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
}
int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
}
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
taskRelationLogList.add(processTaskRelationLog);
}
if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) {
ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations());
ArrayNode newArrayNode = JSONUtils.createArrayNode();
for (int i = 0; i < arrayNode.size(); i++) {
ObjectNode newObjectNode = newArrayNode.addObject();
JsonNode jsonNode = arrayNode.get(i);
Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong());
if (Objects.nonNull(taskCode)) {
newObjectNode.put("taskCode", taskCode);
newObjectNode.set("x", jsonNode.get("x"));
newObjectNode.set("y", jsonNode.get("y"));
}
}
processDefinition.setLocations(newArrayNode.toString());
}
processDefinition.setCreateTime(new Date());
processDefinition.setUpdateTime(new Date());
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList(), otherParamsJson);
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
putMsg(createDagResult, Status.SUCCESS);
} else {
result.putAll(createDagResult); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
Schedule schedule = dagDataSchedule.getSchedule();
if (null != schedule) {
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now);
int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogsList) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList);
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskNode.getType())
.taskParams(taskNode.getTaskParams())
.dependence(taskNode.getDependence())
.switchResult(taskNode.getSwitchResult())
.build())) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e);
}
return result;
}
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())
.forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by project code
*
* @param projectCode project code
* @return process definition list in the project
*/
@Override
public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) {
Map<String, Object> result = new HashMap<>();
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null);
result.put(Constants.DATA_LIST, processDefinitions);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by process definition code
*
* @param projectCode project code
* @param processDefinitionCode process definition code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return task definition list in the process definition
*/
@Override
public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
Set<Long> definitionCodesSet = new HashSet<>();
definitionCodesSet.add(processDefinitionCode);
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet);
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode(
processDefinitions.get(0).getCode(),
processDefinitions.get(0).getVersion());
List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations);
List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) {
DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition();
dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode());
dependentSimplifyDefinition.setName(taskDefinitionLog.getName());
dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion());
taskDefinitionList.add(dependentSimplifyDefinition);
}
result.put(Constants.DATA_LIST, taskDefinitionList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(User loginUser,long projectCode, long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_TREE_VIEW);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | treeViewDto.setType(taskNode.getType());
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Long.parseLong(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,WORKFLOW_BATCH_COPY);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) {
return result;
}
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* Will be deleted
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (projectCode == targetProjectCode) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode,String perm) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,perm);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode,perm);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
protected void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) {
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType());
return;
}
try {
long taskCode = CodeGenerateUtils.getInstance().genCode(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
taskDefinitionLog.setProjectCode(targetProjectCode);
taskDefinitionLog.setVersion(0);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPreTaskCode() > 0) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (processTaskRelationLog.getPostTaskCode() > 0) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
}
}
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(0);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
if (StringUtils.isNotBlank(processDefinition.getLocations())) {
ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations());
for (int i = 0; i < jsonNodes.size(); i++) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ObjectNode node = (ObjectNode) jsonNodes.path(i);
node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong()));
jsonNodes.set(i, node);
}
processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
}
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null, Lists.newArrayList(), otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_SWITCH_TO_THIS_VERSION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR, processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return the pagination process definition versions info of the certain process definition
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize, long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,VERSION_LIST);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinitionLog> processDefinitionVersionsPaging = processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param code process definition code
* @param version version number |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,VERSION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
if (processDefinition.getVersion() == version) {
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version);
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version);
if (deleteLog == 0 || deleteRelationLog == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
deleteOtherRelation(project, result, processDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, "", timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
result = createEmptyDagDefine(loginUser, processDefinition);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isBlank(scheduleJson)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
Map<String, Object> scheduleResult = createDagSchedule(loginUser, processDefinition, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> createEmptyDagDefine(User loginUser, ProcessDefinition processDefinition) {
Map<String, Object> result = new HashMap<>();
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
return result;
}
protected Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (scheduleObj == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
Date now = new Date(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
if (DateUtils.differSec(scheduleObj.getStartTime(), scheduleObj.getEndTime()) == 0) {
logger.warn("The start time must not be the same as the end");
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) {
logger.error("{} verify failure", scheduleObj.getCrontab());
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleObj.getCrontab());
return result;
}
scheduleObj.setWarningType(scheduleObj.getWarningType() == null ? WarningType.NONE : scheduleObj.getWarningType());
scheduleObj.setWarningGroupId(scheduleObj.getWarningGroupId() == 0 ? 1 : scheduleObj.getWarningGroupId());
scheduleObj.setFailureStrategy(scheduleObj.getFailureStrategy() == null ? FailureStrategy.CONTINUE : scheduleObj.getFailureStrategy());
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setProcessInstancePriority(scheduleObj.getProcessInstancePriority() == null ? Priority.MEDIUM : scheduleObj.getProcessInstancePriority());
scheduleObj.setWorkerGroup(scheduleObj.getWorkerGroup() == null ? "default" : scheduleObj.getWorkerGroup());
scheduleObj.setEnvironmentCode(scheduleObj.getEnvironmentCode() == null ? -1 : scheduleObj.getEnvironmentCode());
scheduleMapper.insert(scheduleObj);
putMsg(result, Status.SUCCESS);
result.put("scheduleId", scheduleObj.getId());
return result;
}
/**
* update process definition basic info
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param otherParamsJson otherParamsJson handle other params
* @param executionType executionType
* @return update result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinition.set(projectCode, name, description, globalParams, "", timeout, tenantId);
processDefinition.setExecutionType(executionType);
List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
result = updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, Lists.newArrayList(), otherParamsJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isBlank(scheduleJson)) {
return result;
}
Map<String, Object> scheduleResult = updateDagSchedule(loginUser, projectCode, code, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule schedule = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (schedule == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | FailureStrategy failureStrategy = schedule.getFailureStrategy() == null ? FailureStrategy.CONTINUE : schedule.getFailureStrategy();
WarningType warningType = schedule.getWarningType() == null ? WarningType.NONE : schedule.getWarningType();
Priority processInstancePriority = schedule.getProcessInstancePriority() == null ? Priority.MEDIUM : schedule.getProcessInstancePriority();
int warningGroupId = schedule.getWarningGroupId() == 0 ? 1 : schedule.getWarningGroupId();
String workerGroup = schedule.getWorkerGroup() == null ? "default" : schedule.getWorkerGroup();
long environmentCode = schedule.getEnvironmentCode() == null ? -1 : schedule.getEnvironmentCode();
ScheduleParam param = new ScheduleParam();
param.setStartTime(schedule.getStartTime());
param.setEndTime(schedule.getEndTime());
param.setCrontab(schedule.getCrontab());
param.setTimezoneId(schedule.getTimezoneId());
return schedulerService.updateScheduleByProcessDefinitionCode(
loginUser,
projectCode,
processDefinitionCode,
JSONUtils.toJsonString(param),
warningType,
warningGroupId,
failureStrategy,
processInstancePriority,
workerGroup,
environmentCode);
}
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return update result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> releaseWorkflowAndSchedule(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, "processDefinitionCode:" + code);
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
if (updateProcess > 0) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, scheduleObj.getId(), code);
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), scheduleObj.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,605 | [Bug] [Api] The copied workflow create time and update time is still copied from the original workflow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The copied workflow's create time and update time same to the original workflow
<img width="711" alt="image" src="https://user-images.githubusercontent.com/13765310/175552826-35a319df-b261-40b2-8eea-5fe59d4f7019.png">
### What you expected to happen
copied workflow's create time and update time same should be current time
### How to reproduce
copy the workflow
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10605 | https://github.com/apache/dolphinscheduler/pull/10606 | 35b25da863e38df817bfe3cb2ef758d426b8b699 | 5ebd982e920c9196210fc1e619afb73d81689d2b | 2022-06-24T14:09:03Z | java | 2022-06-28T13:33:58Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * save other relation
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result, String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
@Override
public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) {
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | * 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 static org.apache.dolphinscheduler.common.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.Constants.RESOURCE_TYPE_FILE;
import static org.apache.dolphinscheduler.common.Constants.RESOURCE_TYPE_UDF;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.exception.BaseException;
import org.apache.dolphinscheduler.common.storage.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileStatus; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.security.UserGroupInformation;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
/**
* hadoop utils
* single instance
*/
public class HadoopUtils implements Closeable, StorageOperate { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | private static final Logger logger = LoggerFactory.getLogger(HadoopUtils.class);
private String hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER);
public static final String RM_HA_IDS = PropertyUtils.getString(Constants.YARN_RESOURCEMANAGER_HA_RM_IDS);
public static final String APP_ADDRESS = PropertyUtils.getString(Constants.YARN_APPLICATION_STATUS_ADDRESS);
public static final String JOB_HISTORY_ADDRESS = PropertyUtils.getString(Constants.YARN_JOB_HISTORY_STATUS_ADDRESS);
public static final int HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE = PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088);
private static final String HADOOP_UTILS_KEY = "HADOOP_UTILS_KEY";
private static final LoadingCache<String, HadoopUtils> cache = CacheBuilder
.newBuilder()
.expireAfterWrite(PropertyUtils.getInt(Constants.KERBEROS_EXPIRE_TIME, 2), TimeUnit.HOURS)
.build(new CacheLoader<String, HadoopUtils>() {
@Override
public HadoopUtils load(String key) throws Exception {
return new HadoopUtils();
}
});
private volatile boolean yarnEnabled = false;
private Configuration configuration;
private FileSystem fs;
private HadoopUtils() {
hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER);
init();
initHdfsPath();
}
public static HadoopUtils getInstance() {
return cache.getUnchecked(HADOOP_UTILS_KEY);
}
/**
* init dolphinscheduler root path in hdfs
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | private void initHdfsPath() {
Path path = new Path(RESOURCE_UPLOAD_PATH);
try {
if (!fs.exists(path)) {
fs.mkdirs(path);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* init hadoop configuration
*/
private void init() throws NullPointerException {
try {
configuration = new HdfsConfiguration();
if (CommonUtils.loadKerberosConf(configuration)) {
hdfsUser = "";
}
String defaultFS = configuration.get(Constants.FS_DEFAULT_FS);
if (defaultFS.startsWith("file")) {
String defaultFSProp = PropertyUtils.getString(Constants.FS_DEFAULT_FS);
if (StringUtils.isNotBlank(defaultFSProp)) {
Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs.");
configuration.set(Constants.FS_DEFAULT_FS, defaultFSProp);
fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
} else {
logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULT_FS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | throw new NullPointerException(
String.format("property: %s can not to be empty, please set!", Constants.FS_DEFAULT_FS)
);
}
} else {
logger.info("get property:{} -> {}, from core-site.xml hdfs-site.xml ", Constants.FS_DEFAULT_FS, defaultFS);
}
if (StringUtils.isNotEmpty(hdfsUser)) {
UserGroupInformation ugi = UserGroupInformation.createRemoteUser(hdfsUser);
ugi.doAs((PrivilegedExceptionAction<Boolean>) () -> {
fs = FileSystem.get(configuration);
return true;
});
} else {
logger.warn("resource.hdfs.root.user is not set value!");
fs = FileSystem.get(configuration);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* @return Configuration
*/
public Configuration getConfiguration() {
return configuration;
}
/**
* @return DefaultFS
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | public String getDefaultFS() {
return getConfiguration().get(Constants.FS_DEFAULT_FS);
}
/**
* get application url
* if rmHaIds contains xx, it signs not use resourcemanager
* otherwise:
* if rmHaIds is empty, single resourcemanager enabled
* if rmHaIds not empty: resourcemanager HA enabled
*
* @param applicationId application id
* @return url of application
*/
public String getApplicationUrl(String applicationId) throws BaseException {
yarnEnabled = true;
String appUrl = StringUtils.isEmpty(RM_HA_IDS) ? APP_ADDRESS : getAppAddress(APP_ADDRESS, RM_HA_IDS);
if (StringUtils.isBlank(appUrl)) {
throw new BaseException("yarn application url generation failed");
}
logger.debug("yarn application url:{}, applicationId:{}", appUrl, applicationId);
return String.format(appUrl, HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE, applicationId);
}
public String getJobHistoryUrl(String applicationId) {
String jobId = applicationId.replace("application", "job");
return String.format(JOB_HISTORY_ADDRESS, jobId);
}
/**
* cat file on hdfs
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | * @param hdfsFilePath hdfs file path
* @return byte[] byte array
* @throws IOException errors
*/
public byte[] catFile(String hdfsFilePath) throws IOException {
if (StringUtils.isBlank(hdfsFilePath)) {
logger.error("hdfs file path:{} is blank", hdfsFilePath);
return new byte[0];
}
try (FSDataInputStream fsDataInputStream = fs.open(new Path(hdfsFilePath))) {
return IOUtils.toByteArray(fsDataInputStream);
}
}
/**
* cat file on hdfs
*
* @param hdfsFilePath hdfs file path
* @param skipLineNums skip line numbers
* @param limit read how many lines
* @return content of file
* @throws IOException errors
*/
public List<String> catFile(String hdfsFilePath, int skipLineNums, int limit) throws IOException {
if (StringUtils.isBlank(hdfsFilePath)) {
logger.error("hdfs file path:{} is blank", hdfsFilePath);
return Collections.emptyList();
}
try (FSDataInputStream in = fs.open(new Path(hdfsFilePath))) {
BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
Stream<String> stream = br.lines().skip(skipLineNums).limit(limit); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | return stream.collect(Collectors.toList());
}
}
@Override
public List<String> vimFile(String bucketName, String hdfsFilePath, int skipLineNums, int limit) throws IOException {
return catFile(hdfsFilePath, skipLineNums, limit);
}
@Override
public void createTenantDirIfNotExists(String tenantCode) throws IOException {
getInstance().mkdir(tenantCode, getHdfsResDir(tenantCode));
getInstance().mkdir(tenantCode, getHdfsUdfDir(tenantCode));
}
@Override
public String getResDir(String tenantCode) {
return getHdfsResDir(tenantCode);
}
@Override
public String getUdfDir(String tenantCode) {
return getHdfsUdfDir(tenantCode);
}
/**
* make the given file and all non-existent parents into
* directories. Has the semantics of Unix 'mkdir -p'.
* Existence of the directory hierarchy is not an error.
*
* @param hdfsPath path to create
* @return mkdir result
* @throws IOException errors
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | public boolean mkdir(String tenantCode, String hdfsPath) throws IOException {
return fs.mkdirs(new Path(hdfsPath));
}
@Override
public String getResourceFileName(String tenantCode, String fullName) {
return getHdfsResourceFileName(tenantCode, fullName);
}
@Override
public String getFileName(ResourceType resourceType, String tenantCode, String fileName) {
return getHdfsFileName(resourceType, tenantCode, fileName);
}
@Override
public void download(String bucketName, String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite) throws IOException {
copyHdfsToLocal(srcHdfsFilePath, dstFile, deleteSource, overwrite);
}
/**
* copy files between FileSystems
*
* @param srcPath source hdfs path
* @param dstPath destination hdfs path
* @param deleteSource whether to delete the src
* @param overwrite whether to overwrite an existing file
* @return if success or not
* @throws IOException errors
*/
@Override
public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException {
return FileUtil.copy(fs, new Path(srcPath), fs, new Path(dstPath), deleteSource, overwrite, fs.getConf());
}
/** |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.