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
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
public class TaskPriorityQueueConsumer extends BaseDaemonThread {
/**
* logger of TaskUpdateQueueConsumer
*/
private static final Logger logger = LoggerFactory.getLogger(TaskPriorityQueueConsumer.class);
/**
* taskUpdateQueue
*/
@Autowired
private TaskPriorityQueue<TaskPriority> taskPriorityQueue;
@Autowired
private TaskInstanceDao taskInstanceDao;
/**
* executor dispatcher
*/
@Autowired
private ExecutorDispatcher dispatcher;
/**
* processInstance cache manager
*/
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
/**
* master config
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
@Autowired
private MasterConfig masterConfig;
/**
* task response service
*/
@Autowired
private TaskEventService taskEventService;
/**
* consumer thread pool
*/
private ThreadPoolExecutor consumerThreadPoolExecutor;
protected TaskPriorityQueueConsumer() {
super("TaskPriorityQueueConsumeThread");
}
@PostConstruct
public void init() {
this.consumerThreadPoolExecutor = (ThreadPoolExecutor) ThreadUtils
.newDaemonFixedThreadExecutor("TaskUpdateQueueConsumerThread", masterConfig.getDispatchTaskNumber());
logger.info("Task priority queue consume thread staring");
super.start();
logger.info("Task priority queue consume thread started");
}
@Override
public void run() {
int fetchTaskNum = masterConfig.getDispatchTaskNumber();
while (!ServerLifeCycleManager.isStopped()) {
try {
List<TaskPriority> failedDispatchTasks = this.batchDispatch(fetchTaskNum);
if (CollectionUtils.isNotEmpty(failedDispatchTasks)) {
logger.info("{} tasks dispatch failed, will retry to dispatch", failedDispatchTasks.size());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
TaskMetrics.incTaskDispatchFailed(failedDispatchTasks.size());
for (TaskPriority dispatchFailedTask : failedDispatchTasks) {
taskPriorityQueue.put(dispatchFailedTask);
}
if (fetchTaskNum == failedDispatchTasks.size()) {
logger.info("All tasks dispatch failed, will sleep a while to avoid the master cpu higher");
TimeUnit.MILLISECONDS.sleep(Constants.SLEEP_TIME_MILLIS);
}
}
} catch (Exception e) {
TaskMetrics.incTaskDispatchError();
logger.error("dispatcher task error", e);
}
}
}
/**
* batch dispatch with thread pool
*/
public List<TaskPriority> batchDispatch(int fetchTaskNum) throws TaskPriorityQueueException, InterruptedException {
List<TaskPriority> failedDispatchTasks = Collections.synchronizedList(new ArrayList<>());
CountDownLatch latch = new CountDownLatch(fetchTaskNum);
for (int i = 0; i < fetchTaskNum; i++) {
TaskPriority taskPriority = taskPriorityQueue.poll(Constants.SLEEP_TIME_MILLIS, TimeUnit.MILLISECONDS);
if (Objects.isNull(taskPriority)) {
latch.countDown();
continue;
}
consumerThreadPoolExecutor.submit(() -> {
try {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
boolean dispatchResult = this.dispatchTask(taskPriority);
if (!dispatchResult) {
failedDispatchTasks.add(taskPriority);
}
} finally {
latch.countDown();
}
});
}
latch.await();
return failedDispatchTasks;
}
/**
* Dispatch task to worker.
*
* @param taskPriority taskPriority
* @return dispatch result, return true if dispatch success, return false if dispatch failed.
*/
protected boolean dispatchTask(TaskPriority taskPriority) {
TaskMetrics.incTaskDispatch();
boolean result = false;
try {
WorkflowExecuteRunnable workflowExecuteRunnable =
processInstanceExecCacheManager.getByProcessInstanceId(taskPriority.getProcessInstanceId());
if (workflowExecuteRunnable == null) {
logger.error("Cannot find the related processInstance of the task, taskPriority: {}", taskPriority);
return true;
}
Optional<TaskInstance> taskInstanceOptional =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
workflowExecuteRunnable.getTaskInstance(taskPriority.getTaskId());
if (!taskInstanceOptional.isPresent()) {
logger.error("Cannot find the task instance from related processInstance, taskPriority: {}",
taskPriority);
return true;
}
TaskInstance taskInstance = taskInstanceOptional.get();
TaskExecutionContext context = taskPriority.getTaskExecutionContext();
ExecutionContext executionContext =
new ExecutionContext(toCommand(context), ExecutorType.WORKER, context.getWorkerGroup(),
taskInstance);
if (isTaskNeedToCheck(taskPriority)) {
if (taskInstanceIsFinalState(taskPriority.getTaskId())) {
logger.info("Task {} is already finished, no need to dispatch, task instance id: {}",
taskInstance.getName(), taskInstance.getId());
return true;
}
}
if (checkIsCacheExecution(taskInstance, context)) {
return true;
}
result = dispatcher.dispatch(executionContext);
if (result) {
logger.info("Master success dispatch task to worker, taskInstanceId: {}, worker: {}",
taskPriority.getTaskId(),
executionContext.getHost());
addDispatchEvent(context, executionContext);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
} else {
logger.info("Master failed to dispatch task to worker, taskInstanceId: {}, worker: {}",
taskPriority.getTaskId(),
executionContext.getHost());
}
} catch (RuntimeException | ExecuteException e) {
logger.error("Master dispatch task to worker error, taskPriority: {}", taskPriority, e);
}
return result;
}
/**
* add dispatch event
*/
private void addDispatchEvent(TaskExecutionContext context, ExecutionContext executionContext) {
TaskEvent taskEvent = TaskEvent.newDispatchEvent(context.getProcessInstanceId(), context.getTaskInstanceId(),
executionContext.getHost().getAddress());
taskEventService.addEvent(taskEvent);
}
private Command toCommand(TaskExecutionContext taskExecutionContext) {
TaskDispatchCommand requestCommand = new TaskDispatchCommand(taskExecutionContext,
masterConfig.getMasterAddress(),
taskExecutionContext.getHost(),
System.currentTimeMillis());
return requestCommand.convert2Command();
}
/**
* taskInstance is final state
* success,failure,kill,stop,pause,threadwaiting is final state
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
* @param taskInstanceId taskInstanceId
* @return taskInstance is final state
*/
public boolean taskInstanceIsFinalState(int taskInstanceId) {
TaskInstance taskInstance = taskInstanceDao.findTaskInstanceById(taskInstanceId);
return taskInstance.getState().isFinished();
}
/**
* check if task need to check state, if true, refresh the checkpoint
*/
private boolean isTaskNeedToCheck(TaskPriority taskPriority) {
long now = System.currentTimeMillis();
if (now - taskPriority.getCheckpoint() > Constants.SECOND_TIME_MILLIS) {
taskPriority.setCheckpoint(now);
return true;
}
return false;
}
/**
* check i
* if the task is defined as cache execution, and we find the cache task instance is finished yet, we will not dispatch this task
* @param taskInstance taskInstance
* @param context context
* @return true if we will not dispatch this task, false if we will dispatch this task
*/
private boolean checkIsCacheExecution(TaskInstance taskInstance, TaskExecutionContext context) {
try {
// check i
if (taskInstance.getIsCache().equals(Flag.NO)) {
return false;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
|
}
// check i
String cacheKey = TaskCacheUtils.generateCacheKey(taskInstance, context);
TaskInstance cacheTaskInstance = taskInstanceDao.findTaskInstanceByCacheKey(cacheKey);
// if we c
if (cacheTaskInstance != null) {
logger.info("Task {} is cache, no need to dispatch, task instance id: {}",
taskInstance.getName(), taskInstance.getId());
addCacheEvent(taskInstance, cacheTaskInstance);
taskInstance.setCacheKey(TaskCacheUtils.generateTagCacheKey(cacheTaskInstance.getId(), cacheKey));
return true;
} else {
// if we c
taskInstance.setCacheKey(TaskCacheUtils.generateTagCacheKey(taskInstance.getId(), cacheKey));
}
} catch (Exception e) {
logger.error("checkIsCacheExecution error", e);
}
return false;
}
private void addCacheEvent(TaskInstance taskInstance, TaskInstance cacheTaskInstance) {
if (cacheTaskInstance == null) {
return;
}
TaskEvent taskEvent = TaskEvent.newCacheEvent(taskInstance.getProcessInstanceId(), taskInstance.getId(),
cacheTaskInstance.getId());
taskEventService.addEvent(taskEvent);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.utils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.enums.DataType;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zeroturnaround.zip.ZipUtil;
import com.fasterxml.jackson.databind.JsonNode;
public class TaskFilesTransferUtils {
protected final static Logger logger = LoggerFactory
.getLogger(String.format(TaskConstants.TASK_LOG_LOGGER_NAME_FORMAT, TaskFilesTransferUtils.class));
final static String DOWNLOAD_TMP = ".DT_TMP";
final static String PACK_SUFFIX = "_ds_pack.zip";
final static String RESOURCE_TAG = "DATA_TRANSFER";
private TaskFilesTransferUtils() {
throw new IllegalStateException("Utility class");
}
/**
* upload output files to resource storage
*
* @param taskExecutionContext is the context of task
* @param storageOperate is the storage operate
* @throws TaskException TaskException
*/
public static void uploadOutputFiles(TaskExecutionContext taskExecutionContext,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
StorageOperate storageOperate) throws TaskException {
List<Property> varPools = getVarPools(taskExecutionContext);
Map<String, Property> varPoolsMap = varPools.stream().collect(Collectors.toMap(Property::getProp, x -> x));
List<Property> localParamsProperty = getFileLocalParams(taskExecutionContext, Direct.OUT);
if (localParamsProperty.isEmpty()) {
return;
}
logger.info("Upload output files ...");
for (Property property : localParamsProperty) {
String srcPath =
packIfDir(String.format("%s/%s", taskExecutionContext.getExecutePath(), property.getValue()));
String resourcePath = getResourcePath(taskExecutionContext, new File(srcPath).getName());
try {
String resourceWholePath =
storageOperate.getResourceFileName(taskExecutionContext.getTenantCode(), resourcePath);
logger.info("{} --- Local:{} to Remote:{}", property, srcPath, resourceWholePath);
storageOperate.upload(taskExecutionContext.getTenantCode(), srcPath, resourceWholePath, false, true);
} catch (IOException ex) {
throw new TaskException("Upload file to storage error", ex);
}
Property oriProperty;
if (varPoolsMap.containsKey(property.getProp())) {
oriProperty = varPoolsMap.get(property.getProp());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
} else {
oriProperty = new Property(property.getProp(), Direct.OUT, DataType.FILE, property.getValue());
varPools.add(oriProperty);
}
oriProperty.setProp(String.format("%s.%s", taskExecutionContext.getTaskName(), oriProperty.getProp()));
oriProperty.setValue(resourcePath);
}
taskExecutionContext.setVarPool(JSONUtils.toJsonString(varPools));
}
/**
* download upstream files from storage
* only download files which are defined in the task parameters
*
* @param taskExecutionContext is the context of task
* @param storageOperate is the storage operate
* @throws TaskException task exception
*/
public static void downloadUpstreamFiles(TaskExecutionContext taskExecutionContext, StorageOperate storageOperate) {
List<Property> varPools = getVarPools(taskExecutionContext);
Map<String, Property> varPoolsMap = varPools.stream().collect(Collectors.toMap(Property::getProp, x -> x));
List<Property> localParamsProperty = getFileLocalParams(taskExecutionContext, Direct.IN);
if (localParamsProperty.isEmpty()) {
return;
}
String executePath = taskExecutionContext.getExecutePath();
String downloadTmpPath = String.format("%s/%s", executePath, DOWNLOAD_TMP);
logger.info("Download upstream files...");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
for (Property property : localParamsProperty) {
Property inVarPool = varPoolsMap.get(property.getValue());
if (inVarPool == null) {
logger.error("{} not in {}", property.getValue(), varPoolsMap.keySet());
throw new TaskException(String.format("Can not find upstream file using %s, please check the key",
property.getValue()));
}
String resourcePath = inVarPool.getValue();
String targetPath = String.format("%s/%s", executePath, property.getProp());
String downloadPath;
boolean isPack = resourcePath.endsWith(PACK_SUFFIX);
if (isPack) {
downloadPath = String.format("%s/%s", downloadTmpPath, new File(resourcePath).getName());
} else {
downloadPath = targetPath;
}
try {
String resourceWholePath =
storageOperate.getResourceFileName(taskExecutionContext.getTenantCode(), resourcePath);
logger.info("{} --- Remote:{} to Local:{}", property, resourceWholePath, downloadPath);
storageOperate.download(taskExecutionContext.getTenantCode(), resourceWholePath, downloadPath, false,
true);
} catch (IOException ex) {
throw new TaskException("Download file from storage error", ex);
}
if (isPack) {
File downloadFile = new File(downloadPath);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
logger.info("Unpack {} to {}", downloadPath, targetPath);
ZipUtil.unpack(downloadFile, new File(targetPath));
}
}
try {
org.apache.commons.io.FileUtils.deleteDirectory(new File(downloadTmpPath));
} catch (IOException e) {
logger.error("Delete DownloadTmpPath {} failed, this will not affect the task status", downloadTmpPath, e);
}
}
/**
* get local parameters property which type is FILE and direction is equal to direct
*
* @param taskExecutionContext is the context of task
* @param direct may be Direct.IN or Direct.OUT.
* @return List<Property>
*/
public static List<Property> getFileLocalParams(TaskExecutionContext taskExecutionContext, Direct direct) {
List<Property> localParamsProperty = new ArrayList<>();
JsonNode taskParams = JSONUtils.parseObject(taskExecutionContext.getTaskParams());
for (JsonNode localParam : taskParams.get("localParams")) {
Property property = JSONUtils.parseObject(localParam.toString(), Property.class);
if (property.getDirect().equals(direct) && property.getType().equals(DataType.FILE)) {
localParamsProperty.add(property);
}
}
return localParamsProperty;
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
* get Resource path for manage files in storage
*
* @param taskExecutionContext is the context of task
* @param fileName is the file name
* @return resource path, RESOURCE_TAG/DATE/ProcessDefineCode/ProcessDefineVersion_ProcessInstanceID/TaskName_TaskInstanceID_FileName
*/
public static String getResourcePath(TaskExecutionContext taskExecutionContext, String fileName) {
String date =
DateUtils.formatTimeStamp(taskExecutionContext.getEndTime(), DateTimeFormatter.ofPattern("yyyyMMdd"));
String resourceFolder = String.format("%s/%s/%d/%d_%d", RESOURCE_TAG, date,
taskExecutionContext.getProcessDefineCode(), taskExecutionContext.getProcessDefineVersion(),
taskExecutionContext.getProcessInstanceId());
return String.format("%s/%s_%s_%s", resourceFolder, taskExecutionContext.getTaskName().replace(" ", "_"),
taskExecutionContext.getTaskInstanceId(), fileName);
}
/**
* get varPool from taskExecutionContext
*
* @param taskExecutionContext is the context of task
* @return List<Property>
*/
public static List<Property> getVarPools(TaskExecutionContext taskExecutionContext) {
List<Property> varPools = new ArrayList<>();
String varPoolString = taskExecutionContext.getVarPool();
if (StringUtils.isEmpty(varPoolString)) {
return varPools;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,223 |
[Improvement][Master] Validate same content of input file when using task cache
|
### 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
Task cache mechanism is introduced in https://github.com/apache/dolphinscheduler/pull/13194. Cache key can make sure tasks have the same value of property (store resource path in file paramter), but the same resource path doesn't mean the same file contents. Also, the different resource path may have same content.
For other types of parameter, the same value of property means the same input, keep logic consistency for file parameter, we should check the same content in resourcePath.
Maybe we can add checksum of input file when generating cache key. In addition, i think it's improper to download the whole file in master, we can save checksum in another file when uploading output file, download checksum file when generating cache key.
### 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/13223
|
https://github.com/apache/dolphinscheduler/pull/13298
|
8a479927f35daa21713a58212503a899012e4df2
|
ccad56e88eb21d960baf68b870c7c0dc7b260f63
| 2022-12-19T04:54:34Z |
java
| 2023-01-03T03:38:13Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskFilesTransferUtils.java
|
for (JsonNode varPoolData : JSONUtils.parseArray(varPoolString)) {
Property property = JSONUtils.parseObject(varPoolData.toString(), Property.class);
varPools.add(property);
}
return varPools;
}
/**
* If the path is a directory, pack it and return the path of the package
*
* @param path is the input path, may be a file or a directory
* @return new path
*/
public static String packIfDir(String path) throws TaskException {
File file = new File(path);
if (!file.exists()) {
throw new TaskException(String.format("%s dose not exists", path));
}
String newPath;
if (file.isDirectory()) {
newPath = file.getPath() + PACK_SUFFIX;
logger.info("Pack {} to {}", path, newPath);
ZipUtil.pack(file, new File(newPath));
} else {
newPath = path;
}
return newPath;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterWaitingStrategy.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterWaitingStrategy.java
|
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.registry;
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleException;
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager;
import org.apache.dolphinscheduler.common.lifecycle.ServerStatus;
import org.apache.dolphinscheduler.registry.api.Registry;
import org.apache.dolphinscheduler.registry.api.RegistryClient;
import org.apache.dolphinscheduler.registry.api.RegistryException;
import org.apache.dolphinscheduler.registry.api.StrategyType;
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.event.WorkflowEventQueue;
import org.apache.dolphinscheduler.server.master.rpc.MasterRPCServer;
import org.apache.dolphinscheduler.server.master.runner.StateWheelExecuteThread;
import java.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
/**
* This strategy will change the server status to {@link ServerStatus#WAITING} when disconnect from {@link Registry}.
*/
@Service
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterWaitingStrategy.java
|
@ConditionalOnProperty(prefix = "master.registry-disconnect-strategy", name = "strategy", havingValue = "waiting")
public class MasterWaitingStrategy implements MasterConnectStrategy {
private final Logger logger = LoggerFactory.getLogger(MasterWaitingStrategy.class);
@Autowired
private MasterConfig masterConfig;
@Autowired
private RegistryClient registryClient;
@Autowired
private MasterRPCServer masterRPCServer;
@Autowired
private WorkflowEventQueue workflowEventQueue;
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
@Autowired
private StateWheelExecuteThread stateWheelExecuteThread;
@Override
public void disconnect() {
try {
ServerLifeCycleManager.toWaiting();
clearMasterResource();
Duration maxWaitingTime = masterConfig.getRegistryDisconnectStrategy().getMaxWaitingTime();
try {
logger.info("Master disconnect from registry will try to reconnect in {} s",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterWaitingStrategy.java
|
maxWaitingTime.getSeconds());
registryClient.connectUntilTimeout(maxWaitingTime);
} catch (RegistryException ex) {
throw new ServerLifeCycleException(
String.format("Waiting to reconnect to registry in %s failed", maxWaitingTime), ex);
}
} catch (ServerLifeCycleException e) {
String errorMessage = String.format(
"Disconnect from registry and change the current status to waiting error, the current server state is %s, will stop the current server",
ServerLifeCycleManager.getServerStatus());
logger.error(errorMessage, e);
registryClient.getStoppable().stop(errorMessage);
} catch (RegistryException ex) {
String errorMessage = "Disconnect from registry and waiting to reconnect failed, will stop the server";
logger.error(errorMessage, ex);
registryClient.getStoppable().stop(errorMessage);
} catch (Exception ex) {
String errorMessage = "Disconnect from registry and get an unknown exception, will stop the server";
logger.error(errorMessage, ex);
registryClient.getStoppable().stop(errorMessage);
}
}
@Override
public void reconnect() {
try {
ServerLifeCycleManager.recoverFromWaiting();
reStartMasterResource();
logger.info("Recover from waiting success, the current server status is {}",
ServerLifeCycleManager.getServerStatus());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterWaitingStrategy.java
|
} catch (Exception e) {
String errorMessage =
String.format("Recover from waiting failed, the current server status is %s, will stop the server",
ServerLifeCycleManager.getServerStatus());
logger.error(errorMessage, e);
registryClient.getStoppable().stop(errorMessage);
}
}
@Override
public StrategyType getStrategyType() {
return StrategyType.WAITING;
}
private void clearMasterResource() {
masterRPCServer.close();
logger.warn("Master closed RPC server due to lost registry connection");
workflowEventQueue.clearWorkflowEventQueue();
logger.warn("Master clear workflow event queue due to lost registry connection");
processInstanceExecCacheManager.clearCache();
logger.warn("Master clear process instance cache due to lost registry connection");
stateWheelExecuteThread.clearAllTasks();
logger.warn("Master clear all state wheel task due to lost registry connection");
}
private void reStartMasterResource() {
masterRPCServer.start();
logger.warn("Master restarted RPC server due to reconnect to registry");
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerWaitingStrategy.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.registry;
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleException;
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager;
import org.apache.dolphinscheduler.registry.api.RegistryClient;
import org.apache.dolphinscheduler.registry.api.RegistryException;
import org.apache.dolphinscheduler.registry.api.StrategyType;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.message.MessageRetryRunner;
import org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient;
import org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import java.time.Duration;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerWaitingStrategy.java
|
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
@Service
@ConditionalOnProperty(prefix = "worker.registry-disconnect-strategy", name = "strategy", havingValue = "waiting")
public class WorkerWaitingStrategy implements WorkerConnectStrategy {
private final Logger logger = LoggerFactory.getLogger(WorkerWaitingStrategy.class);
@Autowired
private WorkerConfig workerConfig;
@Autowired
private RegistryClient registryClient;
@Autowired
private WorkerRpcServer workerRpcServer;
@Autowired
private WorkerRpcClient workerRpcClient;
@Autowired
private MessageRetryRunner messageRetryRunner;
@Autowired
private WorkerManagerThread workerManagerThread;
@Override
public void disconnect() {
try {
ServerLifeCycleManager.toWaiting();
clearWorkerResource();
Duration maxWaitingTime = workerConfig.getRegistryDisconnectStrategy().getMaxWaitingTime();
try {
logger.info("Worker disconnect from registry will try to reconnect in {} s",
maxWaitingTime.getSeconds());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerWaitingStrategy.java
|
registryClient.connectUntilTimeout(maxWaitingTime);
} catch (RegistryException ex) {
throw new ServerLifeCycleException(
String.format("Waiting to reconnect to registry in %s failed", maxWaitingTime), ex);
}
} catch (ServerLifeCycleException e) {
String errorMessage = String.format(
"Disconnect from registry and change the current status to waiting error, the current server state is %s, will stop the current server",
ServerLifeCycleManager.getServerStatus());
logger.error(errorMessage, e);
registryClient.getStoppable().stop(errorMessage);
} catch (RegistryException ex) {
String errorMessage = "Disconnect from registry and waiting to reconnect failed, will stop the server";
logger.error(errorMessage, ex);
registryClient.getStoppable().stop(errorMessage);
} catch (Exception ex) {
String errorMessage = "Disconnect from registry and get an unknown exception, will stop the server";
logger.error(errorMessage, ex);
registryClient.getStoppable().stop(errorMessage);
}
}
@Override
public void reconnect() {
try {
ServerLifeCycleManager.recoverFromWaiting();
reStartWorkerResource();
logger.info("Recover from waiting success, the current server status is {}",
ServerLifeCycleManager.getServerStatus());
} catch (Exception e) {
String errorMessage =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,310 |
[Bug] [Worker] When registry recover from SUSPENDED to RECONNECTED, the worker will crash
|
### Search before 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 worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself will try to restart, but actually the worker is still normally running, then will cause "org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail", and finally cause the worker node hang.
Please refer to "Anything else" section for logs.
### What you expected to happen
When worker registry (zookeeper) client recover from SUSPENDED to RECONNECTED, the worker itself no need to restart, just do nothing, and of course, will not crash.
### How to reproduce
Block the network connection from worker node to zookeeper server 2181 port, when we can see the "client timedout" log, the worker registry client will change to SUSPENDED status,
then resume the network connection, then the worker registry client will reconnect to zookeeper server, and status will change to RECONNECTED. Now we can see the exception happen.
### Anything else
```
[INFO] 2022-12-26 11:06:35.672 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672023995663,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[WARN] 2022-12-26 11:06:55.680 +0800 org.apache.zookeeper.ClientCnxn:[1249] - [WorkflowInstance-0][TaskInstance-0] - Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
[WARN] 2022-12-26 11:06:55.683 +0800 org.apache.zookeeper.ClientCnxn:[1292] - [WorkflowInstance-0][TaskInstance-0] - Session 0x1028fe2bbbc003f for server ds-1/10.x.x.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
org.apache.zookeeper.ClientCnxn$SessionTimeoutException: Client session timed out, have not heard from server in 20008ms for session id 0x1028fe2bbbc003f
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1250)
[INFO] 2022-12-26 11:06:55.785 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: SUSPENDED
[WARN] 2022-12-26 11:06:55.786 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[52] - [WorkflowInstance-0][TaskInstance-0] - Registry suspended
[INFO] 2022-12-26 11:06:55.787 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a SUSPENDED event from registry, the current server state is RUNNING
[INFO] 2022-12-26 11:06:57.539 +0800 org.apache.zookeeper.ClientCnxn:[1171] - [WorkflowInstance-0][TaskInstance-0] - Opening socket connection to server ds-1/10.x.x.1:2181.
[INFO] 2022-12-26 11:06:57.540 +0800 org.apache.zookeeper.ClientCnxn:[1173] - [WorkflowInstance-0][TaskInstance-0] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[INFO] 2022-12-26 11:06:57.543 +0800 org.apache.zookeeper.ClientCnxn:[1005] - [WorkflowInstance-0][TaskInstance-0] - Socket connection established, initiating session, client: /10.x.x.2:57590, server: ds-1/10.x.x.1:2181
[INFO] 2022-12-26 11:06:57.567 +0800 org.apache.zookeeper.ClientCnxn:[1444] - [WorkflowInstance-0][TaskInstance-0] - Session establishment complete on server ds-1/10.x.x.1:2181, session id = 0x1028fe2bbbc003f, negotiated timeout = 30000
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.curator.framework.state.ConnectionStateManager:[252] - [WorkflowInstance-0][TaskInstance-0] - State change: RECONNECTED
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[48] - [WorkflowInstance-0][TaskInstance-0] - Registry reconnected
[INFO] 2022-12-26 11:06:57.568 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener:[46] - [WorkflowInstance-0][TaskInstance-0] - Worker received a RECONNECTED event from registry, the current server state is RUNNING
[WARN] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager:[73] - [WorkflowInstance-0][TaskInstance-0] - The current server status is already running, cannot recover form waiting
[INFO] 2022-12-26 11:06:57.569 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[75] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server starting
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[143] - [WorkflowInstance-0][TaskInstance-0] - NettyRemotingServer bind fail bind(..) failed: Address already in use, exit
io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[ERROR] 2022-12-26 11:06:57.573 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy:[104] - [WorkflowInstance-0][TaskInstance-0] - Recover from waiting failed, the current server status is RUNNING, will stop the server
org.apache.dolphinscheduler.remote.exceptions.RemoteException: NettyRemotingServer bind 1234 fail
at org.apache.dolphinscheduler.remote.NettyRemotingServer.start(NettyRemotingServer.java:144)
at org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer.start(WorkerRpcServer.java:93)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reStartWorkerResource(WorkerWaitingStrategy.java:130)
at org.apache.dolphinscheduler.server.worker.registry.WorkerWaitingStrategy.reconnect(WorkerWaitingStrategy.java:97)
at org.apache.dolphinscheduler.server.worker.registry.WorkerConnectionStateListener.onUpdate(WorkerConnectionStateListener.java:54)
at org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener.stateChanged(ZookeeperConnectionStateListener.java:49)
at org.apache.curator.framework.state.ConnectionStateManager.lambda$processEvents$0(ConnectionStateManager.java:281)
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92)
at org.apache.curator.framework.listen.MappingListenerManager.forEach(MappingListenerManager.java:89)
at org.apache.curator.framework.listen.StandardListenerManager.forEach(StandardListenerManager.java:89)
at org.apache.curator.framework.state.ConnectionStateManager.processEvents(ConnectionStateManager.java:281)
at org.apache.curator.framework.state.ConnectionStateManager.access$000(ConnectionStateManager.java:43)
at org.apache.curator.framework.state.ConnectionStateManager$1.call(ConnectionStateManager.java:134)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[INFO] 2022-12-26 11:06:57.577 +0800 org.apache.dolphinscheduler.server.worker.task.WorkerHeartBeatTask:[89] - [WorkflowInstance-0][TaskInstance-0] - Success write worker group heartBeatInfo into registry, workerRegistryPath: /nodes/worker/10.x.x.2:1234 workerHeartBeatInfo: {"startupTime":1671855451894,"reportTime":1672024005673,"cpuUsage":0.01,"memoryUsage":0.72,"loadAverage":0.0,"availablePhysicalMemorySize":2.14,"maxCpuloadAvg":4.0,"reservedMemory":0.03,"diskAvailable":28.47,"serverStatus":0,"processId":5576,"workerHostWeight":100,"workerWaitingTaskCount":0,"workerExecThreadCount":100}
[INFO] 2022-12-26 11:07:00.573 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[148] - [WorkflowInstance-0][TaskInstance-0] - Worker server is stopping, current cause : Recover from waiting failed, the current server status is RUNNING, will stop the server
[INFO] 2022-12-26 11:07:00.594 +0800 org.eclipse.jetty.server.AbstractConnector:[383] - [WorkflowInstance-0][TaskInstance-0] - Stopped ServerConnector@1682e6a{HTTP/1.1, (http/1.1)}{0.0.0.0:1235}
[INFO] 2022-12-26 11:07:00.595 +0800 org.eclipse.jetty.server.session:[149] - [WorkflowInstance-0][TaskInstance-0] - node0 Stopped scavenging
[INFO] 2022-12-26 11:07:00.596 +0800 org.eclipse.jetty.server.handler.ContextHandler.application:[2368] - [WorkflowInstance-0][TaskInstance-0] - Destroying Spring FrameworkServlet 'dispatcherServlet'
[INFO] 2022-12-26 11:07:00.597 +0800 org.eclipse.jetty.server.handler.ContextHandler:[1159] - [WorkflowInstance-0][TaskInstance-0] - Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6abb7b7d{application,/,[file:///tmp/jetty-docbase.1235.4335247786354365438/],STOPPED}
[WARN] 2022-12-26 11:07:00.605 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.607 +0800 org.apache.curator.framework.imps.CuratorFrameworkImpl:[998] - [WorkflowInstance-0][TaskInstance-0] - backgroundOperationsLoop exiting
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.zookeeper.ZooKeeper:[1232] - [WorkflowInstance-0][TaskInstance-0] - Session: 0x1028fe2bbbc003f closed
[INFO] 2022-12-26 11:07:00.721 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.722 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.remote.NettyRemotingServer:[212] - [WorkflowInstance-0][TaskInstance-0] - netty server closed
[INFO] 2022-12-26 11:07:00.726 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.729 +0800 org.apache.zookeeper.ClientCnxn:[568] - [WorkflowInstance-0][TaskInstance-0] - EventThread shut down for session: 0x1028fe2bbbc003f
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.service.log.LogClient:[229] - [WorkflowInstance-0][TaskInstance-0] - LogClientService closed
[INFO] 2022-12-26 11:07:00.730 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[71] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closing
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcClient:[73] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc client closed
[WARN] 2022-12-26 11:07:00.733 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[76] - [WorkflowInstance-0][TaskInstance-0] - Alert client is already closed
[INFO] 2022-12-26 11:07:00.735 +0800 com.zaxxer.hikari.HikariDataSource:[350] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown initiated...
[INFO] 2022-12-26 11:07:00.745 +0800 com.zaxxer.hikari.HikariDataSource:[352] - [WorkflowInstance-0][TaskInstance-0] - DolphinScheduler - Shutdown completed.
[INFO] 2022-12-26 11:07:00.747 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[80] - [WorkflowInstance-0][TaskInstance-0] - Alter client closing
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.remote.NettyRemotingClient:[334] - [WorkflowInstance-0][TaskInstance-0] - netty client closed
[INFO] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.service.alert.AlertClientService:[82] - [WorkflowInstance-0][TaskInstance-0] - Alter client closed
[WARN] 2022-12-26 11:07:00.748 +0800 org.apache.dolphinscheduler.common.model.BaseHeartBeatTask:[69] - [WorkflowInstance-0][TaskInstance-0] - WorkerHeartBeatTask task finished
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient:[111] - [WorkflowInstance-0][TaskInstance-0] - Worker registry client closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[99] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closing
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.rpc.WorkerRpcServer:[101] - [WorkflowInstance-0][TaskInstance-0] - Worker rpc server closed
[INFO] 2022-12-26 11:07:00.749 +0800 org.apache.dolphinscheduler.server.worker.WorkerServer:[155] - [WorkflowInstance-0][TaskInstance-0] - Worker server stopped, current cause: Recover from waiting failed, the current server status is RUNNING, will stop the server
```
### Version
3.1.x
### 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/13310
|
https://github.com/apache/dolphinscheduler/pull/13328
|
2c952139b43ec0f0df96e29295e6849b09cc66a8
|
3b980cb06a22fc1a2e917547c98bb8a4a307f90e
| 2022-12-30T15:48:13Z |
java
| 2023-01-03T11:24:11Z |
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerWaitingStrategy.java
|
String.format("Recover from waiting failed, the current server status is %s, will stop the server",
ServerLifeCycleManager.getServerStatus());
logger.error(errorMessage, e);
registryClient.getStoppable().stop(errorMessage);
}
}
@Override
public StrategyType getStrategyType() {
return StrategyType.WAITING;
}
private void clearWorkerResource() {
workerRpcServer.close();
logger.warn("Worker server close the RPC server due to lost connection from registry");
workerRpcClient.close();
logger.warn("Worker server close the RPC client due to lost connection from registry");
workerManagerThread.clearTask();
logger.warn("Worker server clear the tasks due to lost connection from registry");
messageRetryRunner.clearMessage();
logger.warn("Worker server clear the retry message due to lost connection from registry");
}
private void reStartWorkerResource() {
workerRpcServer.start();
logger.warn("Worker server restart PRC server due to reconnect to registry");
workerRpcClient.start();
logger.warn("Worker server restart PRC client due to reconnect to registry");
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.api.k8s.impl;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.API_VERSION;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMMAND_SPLIT_REGEX;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.CPU;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_KILL;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_SUCCESS;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.IMAGE_PULL_POLICY;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.JOB_TTL_SECONDS;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.LAYER_LABEL;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.LAYER_LABEL_VALUE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MEMORY;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.MI;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.NAME_LABEL;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RESTART_POLICY;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_INSTANCE_ID;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.K8sTaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.plugin.task.api.k8s.AbstractK8sTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.k8s.K8sTaskMainParameters;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils;
import org.apache.commons.lang3.StringUtils;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import org.slf4j.Logger;
import io.fabric8.kubernetes.api.model.EnvVar;
import io.fabric8.kubernetes.api.model.Quantity;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.fabric8.kubernetes.api.model.batch.v1.Job;
import io.fabric8.kubernetes.api.model.batch.v1.JobBuilder;
import io.fabric8.kubernetes.api.model.batch.v1.JobStatus;
import io.fabric8.kubernetes.client.Watch;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.WatcherException;
/**
* K8sTaskExecutor used to submit k8s task to K8S
*/
public class K8sTaskExecutor extends AbstractK8sTaskExecutor {
private Job job;
public K8sTaskExecutor(Logger logger, TaskExecutionContext taskRequest) {
super(logger, taskRequest);
}
public Job buildK8sJob(K8sTaskMainParameters k8STaskMainParameters) {
String taskInstanceId = String.valueOf(taskRequest.getTaskInstanceId());
String taskName = taskRequest.getTaskName().toLowerCase(Locale.ROOT);
String image = k8STaskMainParameters.getImage();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
String namespaceName = k8STaskMainParameters.getNamespaceName();
Map<String, String> otherParams = k8STaskMainParameters.getParamsMap();
Double podMem = k8STaskMainParameters.getMinMemorySpace();
Double podCpu = k8STaskMainParameters.getMinCpuCores();
Double limitPodMem = podMem * 2;
Double limitPodCpu = podCpu * 2;
int retryNum = 0;
String k8sJobName = String.format("%s-%s", taskName, taskInstanceId);
Map<String, Quantity> reqRes = new HashMap<>();
reqRes.put(MEMORY, new Quantity(String.format("%s%s", podMem, MI)));
reqRes.put(CPU, new Quantity(String.valueOf(podCpu)));
Map<String, Quantity> limitRes = new HashMap<>();
limitRes.put(MEMORY, new Quantity(String.format("%s%s", limitPodMem, MI)));
limitRes.put(CPU, new Quantity(String.valueOf(limitPodCpu)));
Map<String, String> labelMap = new HashMap<>();
labelMap.put(LAYER_LABEL, LAYER_LABEL_VALUE);
labelMap.put(NAME_LABEL, k8sJobName);
EnvVar taskInstanceIdVar = new EnvVar(TASK_INSTANCE_ID, taskInstanceId, null);
List<EnvVar> envVars = new ArrayList<>();
envVars.add(taskInstanceIdVar);
if (MapUtils.isNotEmpty(otherParams)) {
for (Map.Entry<String, String> entry : otherParams.entrySet()) {
String param = entry.getKey();
String paramValue = entry.getValue();
EnvVar envVar = new EnvVar(param, paramValue, null);
envVars.add(envVar);
}
}
String commandString = k8STaskMainParameters.getCommand();
List<String> commands = new ArrayList<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
if (commandString != null) {
Matcher commandMatcher = COMMAND_SPLIT_REGEX.matcher(commandString.trim());
while (commandMatcher.find()) {
commands.add(commandMatcher.group());
}
}
return new JobBuilder()
.withApiVersion(API_VERSION)
.withNewMetadata()
.withName(k8sJobName)
.withLabels(labelMap)
.withNamespace(namespaceName)
.endMetadata()
.withNewSpec()
.withTtlSecondsAfterFinished(JOB_TTL_SECONDS)
.withNewTemplate()
.withNewSpec()
.addNewContainer()
.withName(k8sJobName)
.withImage(image)
.withCommand(commands.size() == 0 ? null : commands)
.withImagePullPolicy(IMAGE_PULL_POLICY)
.withResources(new ResourceRequirements(limitRes, reqRes))
.withEnv(envVars)
.endContainer()
.withRestartPolicy(RESTART_POLICY)
.endSpec()
.endTemplate()
.withBackoffLimit(retryNum)
.endSpec()
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
.build();
}
public void registerBatchJobWatcher(Job job, String taskInstanceId, TaskResponse taskResponse,
K8sTaskMainParameters k8STaskMainParameters) {
CountDownLatch countDownLatch = new CountDownLatch(1);
Watcher<Job> watcher = new Watcher<Job>() {
@Override
public void eventReceived(Action action, Job job) {
if (action != Action.ADDED) {
int jobStatus = getK8sJobStatus(job);
setTaskStatus(jobStatus, taskInstanceId, taskResponse, k8STaskMainParameters);
countDownLatch.countDown();
}
}
@Override
public void onClose(WatcherException e) {
logStringBuffer.append(String.format("[K8sJobExecutor-%s] fail in k8s: %s", job.getMetadata().getName(),
e.getMessage()));
taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
countDownLatch.countDown();
}
};
Watch watch = null;
try {
watch = k8sUtils.createBatchJobWatcher(job.getMetadata().getName(), watcher);
boolean timeoutFlag = taskRequest.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED
|| taskRequest.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
if (timeoutFlag) {
Boolean timeout = !(countDownLatch.await(taskRequest.getTaskTimeout(), TimeUnit.SECONDS));
waitTimeout(timeout);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
} else {
countDownLatch.await();
}
flushLog(taskResponse);
} catch (InterruptedException e) {
logger.error("job failed in k8s: {}", e.getMessage(), e);
Thread.currentThread().interrupt();
taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
} catch (Exception e) {
logger.error("job failed in k8s: {}", e.getMessage(), e);
taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
} finally {
if (watch != null) {
watch.close();
}
}
}
@Override
public TaskResponse run(String k8sParameterStr) throws Exception {
TaskResponse result = new TaskResponse();
int taskInstanceId = taskRequest.getTaskInstanceId();
K8sTaskMainParameters k8STaskMainParameters =
JSONUtils.parseObject(k8sParameterStr, K8sTaskMainParameters.class);
try {
if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) {
result.setExitStatusCode(EXIT_CODE_KILL);
return result;
}
if (StringUtils.isEmpty(k8sParameterStr)) {
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
return result;
}
K8sTaskExecutionContext k8sTaskExecutionContext = taskRequest.getK8sTaskExecutionContext();
String configYaml = k8sTaskExecutionContext.getConfigYaml();
k8sUtils.buildClient(configYaml);
submitJob2k8s(k8sParameterStr);
registerBatchJobWatcher(job, Integer.toString(taskInstanceId), result, k8STaskMainParameters);
} catch (Exception e) {
cancelApplication(k8sParameterStr);
result.setExitStatusCode(EXIT_CODE_FAILURE);
throw e;
}
return result;
}
@Override
public void cancelApplication(String k8sParameterStr) {
if (job != null) {
stopJobOnK8s(k8sParameterStr);
}
}
@Override
public void submitJob2k8s(String k8sParameterStr) {
int taskInstanceId = taskRequest.getTaskInstanceId();
String taskName = taskRequest.getTaskName().toLowerCase(Locale.ROOT);
K8sTaskMainParameters k8STaskMainParameters =
JSONUtils.parseObject(k8sParameterStr, K8sTaskMainParameters.class);
try {
logger.info("[K8sJobExecutor-{}-{}] start to submit job", taskName, taskInstanceId);
job = buildK8sJob(k8STaskMainParameters);
stopJobOnK8s(k8sParameterStr);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
String namespaceName = k8STaskMainParameters.getNamespaceName();
k8sUtils.createJob(namespaceName, job);
logger.info("[K8sJobExecutor-{}-{}] submitted job successfully", taskName, taskInstanceId);
} catch (Exception e) {
logger.error("[K8sJobExecutor-{}-{}] fail to submit job", taskName, taskInstanceId);
throw new TaskException("K8sJobExecutor fail to submit job", e);
}
}
@Override
public void stopJobOnK8s(String k8sParameterStr) {
K8sTaskMainParameters k8STaskMainParameters =
JSONUtils.parseObject(k8sParameterStr, K8sTaskMainParameters.class);
String namespaceName = k8STaskMainParameters.getNamespaceName();
String jobName = job.getMetadata().getName();
try {
if (Boolean.TRUE.equals(k8sUtils.jobExist(jobName, namespaceName))) {
k8sUtils.deleteJob(jobName, namespaceName);
}
} catch (Exception e) {
logger.error("[K8sJobExecutor-{}] fail to stop job", jobName);
throw new TaskException("K8sJobExecutor fail to stop job", e);
}
}
public int getK8sJobStatus(Job job) {
JobStatus jobStatus = job.getStatus();
if (jobStatus.getSucceeded() != null && jobStatus.getSucceeded() == 1) {
return EXIT_CODE_SUCCESS;
} else if (jobStatus.getFailed() != null && jobStatus.getFailed() == 1) {
return EXIT_CODE_FAILURE;
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,309 |
[Bug] [K8s Workflow Node] The job on k8s is running, but the node shows failure
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
After the job is submitted to k8s, the node fails. (in fact, the job on k8s is running)
And I can't find any error logs.
```
...
...
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
...
...
```
Full log
```
[INFO] 2022-12-30 16:33:15.641 +0800 - Begin to pulling task
[INFO] 2022-12-30 16:33:15.708 +0800 - Begin to initialize task
[INFO] 2022-12-30 16:33:15.741 +0800 - Set task startTime: Fri Dec 30 16:33:15 CST 2022
[INFO] 2022-12-30 16:33:15.783 +0800 - Set task envFile: /opt/dolphinscheduler/conf/dolphinscheduler_env.sh
[INFO] 2022-12-30 16:33:15.784 +0800 - Set task appId: 36_68
[INFO] 2022-12-30 16:33:15.833 +0800 - End initialize task
[INFO] 2022-12-30 16:33:15.834 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2022-12-30 16:33:15.835 +0800 - TenantCode:root check success
[INFO] 2022-12-30 16:33:15.917 +0800 - ProcessExecDir:/tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68 check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Resources:{} check success
[INFO] 2022-12-30 16:33:15.951 +0800 - Task plugin: K8S create success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success initialized task plugin instance success
[INFO] 2022-12-30 16:33:15.951 +0800 - Success set taskVarPool: null
[INFO] 2022-12-30 16:33:15.955 +0800 - [K8sJobExecutor-examples-68] start to submit job
[INFO] 2022-12-30 16:33:16.195 +0800 - [K8sJobExecutor-examples-68] submitted job successfully
[INFO] 2022-12-30 16:33:57.990 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2022-12-30 16:33:57.990 +0800 - Remove the current task execute context from worker cache
[INFO] 2022-12-30 16:33:58.023 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/7826084625920/8058590247072_4/36/68
```
### What you expected to happen
The k8s node is awesome, hope it works
### How to reproduce
Version: 3.1.1
Create a workflow, add k8s task nodes, and use a correct image ...
Always happens.
### Anything else
_No response_
### Version
3.1.x
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13309
|
https://github.com/apache/dolphinscheduler/pull/13348
|
313ba4444f8949b5335139991cc7d71cc10cd57b
|
ba0a253f09fa55e1100a1f340eca9bde7d88a682
| 2022-12-30T10:41:29Z |
java
| 2023-01-06T01:44:12Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/impl/K8sTaskExecutor.java
|
return TaskConstants.RUNNING_CODE;
}
}
public void setTaskStatus(int jobStatus, String taskInstanceId, TaskResponse taskResponse,
K8sTaskMainParameters k8STaskMainParameters) {
if (jobStatus == EXIT_CODE_SUCCESS || jobStatus == EXIT_CODE_FAILURE) {
if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(Integer.valueOf(taskInstanceId))) {
logStringBuffer.append(String.format("[K8sJobExecutor-%s] killed", job.getMetadata().getName()));
taskResponse.setExitStatusCode(EXIT_CODE_KILL);
} else if (jobStatus == EXIT_CODE_SUCCESS) {
logStringBuffer
.append(String.format("[K8sJobExecutor-%s] succeed in k8s", job.getMetadata().getName()));
taskResponse.setExitStatusCode(EXIT_CODE_SUCCESS);
} else {
String errorMessage =
k8sUtils.getPodLog(job.getMetadata().getName(), k8STaskMainParameters.getNamespaceName());
logStringBuffer.append(String.format("[K8sJobExecutor-%s] fail in k8s: %s", job.getMetadata().getName(),
errorMessage));
taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
}
}
}
public Job getJob() {
return job;
}
public void setJob(Job job) {
this.job = job;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.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.api.service.impl;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_VERSION_VIEW;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION;
import org.apache.dolphinscheduler.api.dto.task.TaskCreateRequest;
import org.apache.dolphinscheduler.api.dto.task.TaskFilterRequest;
import org.apache.dolphinscheduler.api.dto.task.TaskUpdateRequest;
import org.apache.dolphinscheduler.api.dto.taskRelation.TaskRelationUpdateUpstreamRequest;
import org.apache.dolphinscheduler.api.dto.workflow.WorkflowUpdateRequest;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.permission.PermissionCheck;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessTaskRelationService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskDefinitionVo;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
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.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskMainInfo;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
import org.apache.dolphinscheduler.dao.repository.TaskDefinitionDao;
import org.apache.dolphinscheduler.plugin.task.api.TaskPluginManager;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
/**
* task definition service impl
*/
@Service
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(TaskDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskDefinitionDao taskDefinitionDao;
@Autowired
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private ProcessTaskRelationService processTaskRelationService;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessService processService;
@Autowired
private TaskPluginManager taskPluginManager;
@Autowired
private ProcessDefinitionService processDefinitionService;
/**
* create task definition
*
* @param loginUser login user
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
* @param projectCode project code
* @param taskDefinitionJson task definition json
*/
@Transactional
@Override
public Map<String, Object> createTaskDefinition(User loginUser,
long projectCode,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION_CREATE);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
if (CollectionUtils.isEmpty(taskDefinitionLogs)) {
logger.warn("Parameter taskDefinitionJson is invalid.");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType())
.taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
logger.warn("Task definition {} parameters are invalid.", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
return result;
}
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, Boolean.TRUE);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
logger.error("Create task definition error, projectCode:{}.", projectCode);
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
Map<String, Object> resData = new HashMap<>();
resData.put("total", taskDefinitionLogs.size());
resData.put("code", StringUtils
.join(taskDefinitionLogs.stream().map(TaskDefinition::getCode).collect(Collectors.toList()), ","));
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, resData);
return result;
}
private TaskDefinitionLog persist2TaskDefinitionLog(User user, TaskDefinition taskDefinition) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setOperator(user.getId());
taskDefinitionLog.setOperateTime(new Date());
int result = taskDefinitionLogMapper.insert(taskDefinitionLog);
if (result <= 0) {
throw new ServiceException(Status.CREATE_TASK_DEFINITION_LOG_ERROR, taskDefinitionLog.getName());
}
return taskDefinitionLog;
}
private void checkTaskDefinitionValid(User user, TaskDefinition taskDefinition, String permissions) {
Project project = projectMapper.queryByCode(taskDefinition.getProjectCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
projectService.checkProjectAndAuthThrowException(user, project, permissions);
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinition.getTaskType())
.taskParams(taskDefinition.getTaskParams())
.dependence(taskDefinition.getDependence())
.build())) {
throw new ServiceException(Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinition.getName());
}
}
private List<ProcessTaskRelation> updateTaskUpstreams(User user, long workflowCode, long taskCode,
String upstreamCodes) {
TaskRelationUpdateUpstreamRequest taskRelationUpdateUpstreamRequest = new TaskRelationUpdateUpstreamRequest();
taskRelationUpdateUpstreamRequest.setWorkflowCode(workflowCode);
if (upstreamCodes != null) {
taskRelationUpdateUpstreamRequest.setUpstreams(upstreamCodes);
}
return processTaskRelationService.updateUpstreamTaskDefinitionWithSyncDag(user, taskCode, Boolean.FALSE,
taskRelationUpdateUpstreamRequest);
}
private ProcessDefinition updateWorkflowLocation(User user, ProcessDefinition processDefinition) {
WorkflowUpdateRequest workflowUpdateRequest = new WorkflowUpdateRequest();
workflowUpdateRequest.setLocation(null);
return processDefinitionService.updateSingleProcessDefinition(user, processDefinition.getCode(),
workflowUpdateRequest);
}
/**
* Create resource task definition
*
* @param loginUser login user
* @param taskCreateRequest task definition json
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
* @return new TaskDefinition have created
*/
@Override
@Transactional
public TaskDefinition createTaskDefinitionV2(User loginUser,
TaskCreateRequest taskCreateRequest) {
TaskDefinition taskDefinition = taskCreateRequest.convert2TaskDefinition();
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(taskCreateRequest.getWorkflowCode());
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, taskCreateRequest.getWorkflowCode());
}
if (taskDefinition.getProjectCode() == 0L) {
taskDefinition.setProjectCode(processDefinition.getProjectCode());
}
this.checkTaskDefinitionValid(loginUser, taskDefinition, TASK_DEFINITION_CREATE);
long taskDefinitionCode;
try {
taskDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
taskDefinition.setCode(taskDefinitionCode);
int create = taskDefinitionMapper.insert(taskDefinition);
if (create <= 0) {
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
this.persist2TaskDefinitionLog(loginUser, taskDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
this.updateTaskUpstreams(loginUser, taskCreateRequest.getWorkflowCode(), taskDefinition.getCode(),
taskCreateRequest.getUpstreamTasksCodes());
this.updateWorkflowLocation(loginUser, processDefinition);
return taskDefinition;
}
/**
* create single task definition that binds the workflow
*
* @param loginUser login user
* @param projectCode project code
* @param processDefinitionCode process definition code
* @param taskDefinitionJsonObj task definition json object
* @param upstreamCodes upstream task codes, sep comma
* @return create result code
*/
@Transactional
@Override
public Map<String, Object> createTaskBindsWorkFlow(User loginUser,
long projectCode,
long processDefinitionCode,
String taskDefinitionJsonObj,
String upstreamCodes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION_CREATE);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processDefinitionCode:{}.", processDefinitionCode);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
logger.warn("Task definition can not be created due to process definition is {}, processDefinitionCode:{}.",
ReleaseState.ONLINE.getDescp(), processDefinition.getCode());
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, String.valueOf(processDefinitionCode));
return result;
}
TaskDefinitionLog taskDefinition = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
if (taskDefinition == null) {
logger.warn("Parameter taskDefinitionJsonObj is invalid json.");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj);
return result;
}
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinition.getTaskType())
.taskParams(taskDefinition.getTaskParams())
.dependence(taskDefinition.getDependence())
.build())) {
logger.error("Task definition {} parameters are invalid", taskDefinition.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinition.getName());
return result;
}
long taskCode = taskDefinition.getCode();
if (taskCode == 0) {
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
}
List<ProcessTaskRelationLog> processTaskRelationLogList =
processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode)
.stream()
.map(ProcessTaskRelationLog::new)
.collect(Collectors.toList());
if (StringUtils.isNotBlank(upstreamCodes)) {
Set<Long> upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong)
.collect(Collectors.toSet());
List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes);
Set<Long> queryUpStreamTaskCodes =
upstreamTaskDefinitionList.stream().map(TaskDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = upstreamTaskCodes.stream().filter(code -> !queryUpStreamTaskCodes.contains(code))
.collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(diffCode)) {
String taskCodes = StringUtils.join(diffCode, Constants.COMMA);
logger.error("Some task definitions with parameter upstreamCodes do not exist, taskDefinitionCodes:{}.",
taskCodes);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCodes);
return result;
}
for (TaskDefinition upstreamTask : upstreamTaskDefinitionList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog();
processTaskRelationLog.setPreTaskCode(upstreamTask.getCode());
processTaskRelationLog.setPreTaskVersion(upstreamTask.getVersion());
processTaskRelationLog.setPostTaskCode(taskCode);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setConditionType(ConditionType.NONE);
processTaskRelationLog.setConditionParams("{}");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
processTaskRelationLogList.add(processTaskRelationLog);
}
} else {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog();
processTaskRelationLog.setPreTaskCode(0);
processTaskRelationLog.setPreTaskVersion(0);
processTaskRelationLog.setPostTaskCode(taskCode);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setConditionType(ConditionType.NONE);
processTaskRelationLog.setConditionParams("{}");
processTaskRelationLogList.add(processTaskRelationLog);
}
int insertResult = processService.saveTaskRelation(loginUser, projectCode, processDefinition.getCode(),
processDefinition.getVersion(),
processTaskRelationLogList, Lists.newArrayList(), Boolean.TRUE);
if (insertResult != Constants.EXIT_CODE_SUCCESS) {
logger.error(
"Save new version process task relations error, processDefinitionCode:{}, processDefinitionVersion:{}.",
processDefinition.getCode(), processDefinition.getVersion());
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
} else
logger.info(
"Save new version process task relations complete, processDefinitionCode:{}, processDefinitionVersion:{}.",
processDefinition.getCode(), processDefinition.getVersion());
int saveTaskResult =
processService.saveTaskDefine(loginUser, projectCode, Lists.newArrayList(taskDefinition), Boolean.TRUE);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
logger.error("Save task definition error, projectCode:{}, taskDefinitionCode:{}.", projectCode,
taskDefinition.getCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
} else
logger.info("Save task definition complete, projectCode:{}, taskDefinitionCode:{}.", projectCode,
taskDefinition.getCode());
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, taskDefinition);
return result;
}
/**
* query task definition
*
* @param loginUser login user
* @param projectCode project code
* @param processCode process code
* @param taskName task name
*/
@Override
public Map<String, Object> queryTaskDefinitionByName(User loginUser, long projectCode, long processCode,
String taskName) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), processCode, taskName);
if (taskDefinition == null) {
logger.error("Task definition does not exist, taskName:{}.", taskName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskName);
} else {
result.put(Constants.DATA_LIST, taskDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* Whether task definition can be deleted or not
*/
private void taskCanDeleteValid(User user, TaskDefinition taskDefinition, User loginUser) {
Project project = projectMapper.queryByCode(taskDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(user, project, TASK_DEFINITION_DELETE);
Map<String, Object> result = new HashMap<>();
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
throw new ServiceException(Status.TASK_DEFINE_STATE_ONLINE, taskDefinition.getCode());
}
if (processService.isTaskOnline(taskDefinition.getCode()) && taskDefinition.getFlag() == Flag.YES) {
throw new ServiceException(Status.TASK_DEFINE_STATE_ONLINE, taskDefinition.getCode());
}
List<ProcessTaskRelation> processTaskRelationList =
processTaskRelationMapper.queryDownstreamByTaskCode(taskDefinition.getCode());
if (CollectionUtils.isNotEmpty(processTaskRelationList)) {
Set<Long> postTaskCodes = processTaskRelationList
.stream()
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
.map(ProcessTaskRelation::getPostTaskCode)
.collect(Collectors.toSet());
String postTaskCodesStr = StringUtils.join(postTaskCodes, Constants.COMMA);
throw new ServiceException(Status.TASK_HAS_DOWNSTREAM, postTaskCodesStr);
}
}
/**
* Delete resource task definition by code
*
* Only task release state offline and no downstream tasks can be deleted, will also remove the exists
* task relation [upstreamTaskCode, taskCode]
*
* @param loginUser login user
* @param taskCode task code
*/
@Transactional
@Override
public void deleteTaskDefinitionByCode(User loginUser, long taskCode) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCode);
}
this.taskCanDeleteValid(loginUser, taskDefinition, loginUser);
int delete = taskDefinitionMapper.deleteByCode(taskCode);
if (delete <= 0) {
throw new ServiceException(Status.DELETE_TASK_DEFINE_BY_CODE_MSG_ERROR, taskDefinition.getCode());
}
List<ProcessTaskRelation> taskRelationList =
processTaskRelationMapper.queryUpstreamByCode(taskDefinition.getProjectCode(), taskCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
if (CollectionUtils.isNotEmpty(taskRelationList)) {
logger.debug(
"Task definition has upstream tasks, start handle them after delete task, taskDefinitionCode:{}.",
taskCode);
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper
.queryByProcessCode(taskDefinition.getProjectCode(), processDefinitionCode);
List<ProcessTaskRelation> relationList = processTaskRelations.stream()
.filter(r -> r.getPostTaskCode() != taskCode).collect(Collectors.toList());
updateDag(loginUser, processDefinitionCode, relationList, Lists.newArrayList());
}
}
public void updateDag(User loginUser, long processDefinitionCode,
List<ProcessTaskRelation> processTaskRelationList,
List<TaskDefinitionLog> taskDefinitionLogs) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
if (processDefinition == null) {
logger.error("Process definition does not exist, processDefinitionCode:{}.", processDefinitionCode);
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion <= 0) {
logger.error("Update process definition error, projectCode:{}, processDefinitionCode:{}.",
processDefinition.getProjectCode(), processDefinitionCode);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
} else
logger.info(
"Save new version process definition complete, projectCode:{}, processDefinitionCode:{}, newVersion:{}.",
processDefinition.getProjectCode(), processDefinitionCode, insertVersion);
List<ProcessTaskRelationLog> relationLogs =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(),
insertVersion, relationLogs, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
logger.info(
"Save new version task relations complete, projectCode:{}, processDefinitionCode:{}, newVersion:{}.",
processDefinition.getProjectCode(), processDefinitionCode, insertVersion);
} else {
logger.error("Update task relations error, projectCode:{}, processDefinitionCode:{}.",
processDefinition.getProjectCode(), processDefinitionCode);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
}
/**
* update task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task code
* @param taskDefinitionJsonObj task definition json object
*/
@Transactional
@Override
public Map<String, Object> updateTaskDefinition(User loginUser, long projectCode, long taskCode,
String taskDefinitionJsonObj) {
Map<String, Object> result = new HashMap<>();
TaskDefinitionLog taskDefinitionToUpdate =
updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result);
if (taskDefinitionToUpdate == null) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
return result;
}
List<ProcessTaskRelation> taskRelationList =
processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
if (CollectionUtils.isNotEmpty(taskRelationList)) {
logger.info(
"Task definition has upstream tasks, start handle them after update task, taskDefinitionCode:{}.",
taskCode);
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
updateDag(loginUser, processDefinitionCode, processTaskRelations,
Lists.newArrayList(taskDefinitionToUpdate));
}
logger.info("Update task definition complete, projectCode:{}, taskDefinitionCode:{}.", projectCode, taskCode);
result.put(Constants.DATA_LIST, taskCode);
putMsg(result, Status.SUCCESS);
return result;
}
private void TaskDefinitionUpdateValid(TaskDefinition taskDefinitionOriginal, TaskDefinition taskDefinitionUpdate) {
if (processService.isTaskOnline(taskDefinitionOriginal.getCode())
&& taskDefinitionOriginal.getFlag() == Flag.YES) {
if (taskDefinitionOriginal.getTaskExecuteType() != TaskExecuteType.STREAM) {
throw new ServiceException(Status.NOT_SUPPORT_UPDATE_TASK_DEFINITION);
}
}
if (taskDefinitionOriginal.equals(taskDefinitionUpdate)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
throw new ServiceException(Status.TASK_DEFINITION_NOT_CHANGE, taskDefinitionOriginal.getCode());
}
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionOriginal.getCode());
if (version == null || version == 0) {
throw new ServiceException(Status.DATA_IS_NOT_VALID, taskDefinitionOriginal.getCode());
}
}
/**
* update task definition
*
* @param loginUser login user
* @param taskCode task code
* @param taskUpdateRequest task definition json object
* @return new TaskDefinition have updated
*/
@Transactional
@Override
public TaskDefinition updateTaskDefinitionV2(User loginUser,
long taskCode,
TaskUpdateRequest taskUpdateRequest) {
TaskDefinition taskDefinitionOriginal = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinitionOriginal == null) {
throw new ServiceException(Status.TASK_DEFINITION_NOT_EXISTS, taskCode);
}
TaskDefinition taskDefinitionUpdate;
try {
taskDefinitionUpdate = taskUpdateRequest.mergeIntoTaskDefinition(taskDefinitionOriginal);
} catch (InvocationTargetException | IllegalAccessException | InstantiationException
| NoSuchMethodException e) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, taskUpdateRequest.toString());
}
this.checkTaskDefinitionValid(loginUser, taskDefinitionUpdate, TASK_DEFINITION_UPDATE);
this.TaskDefinitionUpdateValid(taskDefinitionOriginal, taskDefinitionUpdate);
int update = taskDefinitionMapper.updateById(taskDefinitionUpdate);
if (update <= 0) {
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
TaskDefinitionLog taskDefinitionLog = this.persist2TaskDefinitionLog(loginUser, taskDefinitionUpdate);
List<ProcessTaskRelation> taskRelationList =
processTaskRelationMapper.queryUpstreamByCode(taskDefinitionUpdate.getProjectCode(), taskCode);
if (CollectionUtils.isNotEmpty(taskRelationList)) {
logger.info(
"Task definition has upstream tasks, start handle them after update task, taskDefinitionCode:{}.",
taskCode);
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper
.queryByProcessCode(taskDefinitionUpdate.getProjectCode(), processDefinitionCode);
updateDag(loginUser, processDefinitionCode, processTaskRelations, Lists.newArrayList(taskDefinitionLog));
}
this.updateTaskUpstreams(loginUser, taskUpdateRequest.getWorkflowCode(), taskDefinitionUpdate.getCode(),
taskUpdateRequest.getUpstreamTasksCodes());
return taskDefinitionUpdate;
}
/**
* Get resource task definition by code
*
* @param loginUser login user
* @param taskCode task code
* @return TaskDefinition
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
*/
@Override
public TaskDefinition getTaskDefinition(User loginUser,
long taskCode) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCode);
}
Project project = projectMapper.queryByCode(taskDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(loginUser, project, TASK_DEFINITION);
return taskDefinition;
}
/**
* Get resource task definition according to query parameter
*
* @param loginUser login user
* @param taskFilterRequest taskFilterRequest object you want to filter the resource task definitions
* @return TaskDefinitions of page
*/
@Override
public PageInfo<TaskDefinition> filterTaskDefinition(User loginUser,
TaskFilterRequest taskFilterRequest) {
TaskDefinition taskDefinition = taskFilterRequest.convert2TaskDefinition();
if (taskDefinition.getProjectName() != null) {
Project project = projectMapper.queryByName(taskDefinition.getProjectName());
projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION);
taskDefinition.setProjectCode(project.getCode());
}
Page<TaskDefinition> page =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
new Page<>(taskFilterRequest.getPageNo(), taskFilterRequest.getPageSize());
IPage<TaskDefinition> taskDefinitionIPage =
taskDefinitionMapper.filterTaskDefinition(page, taskDefinition);
PageInfo<TaskDefinition> pageInfo =
new PageInfo<>(taskFilterRequest.getPageNo(), taskFilterRequest.getPageSize());
pageInfo.setTotal((int) taskDefinitionIPage.getTotal());
pageInfo.setTotalList(taskDefinitionIPage.getRecords());
return pageInfo;
}
private TaskDefinitionLog updateTask(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj,
Map<String, Object> result) {
Project project = projectMapper.queryByCode(projectCode);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return null;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
logger.error("Task definition does not exist, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode));
return null;
}
if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) {
if (taskDefinition.getTaskExecuteType() != TaskExecuteType.STREAM) {
logger.warn("Only {} type task can be updated without online check, taskDefinitionCode:{}.",
TaskExecuteType.STREAM, taskCode);
putMsg(result, Status.NOT_SUPPORT_UPDATE_TASK_DEFINITION);
return null;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
}
}
TaskDefinitionLog taskDefinitionToUpdate =
JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) {
taskDefinition.setTimeoutNotifyStrategy(null);
}
if (taskDefinition.equals(taskDefinitionToUpdate)) {
logger.warn("Task definition does not need update because no change, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.TASK_DEFINITION_NOT_MODIFY_ERROR, String.valueOf(taskCode));
return null;
}
if (taskDefinitionToUpdate == null) {
logger.warn("Parameter taskDefinitionJson is invalid.");
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj);
return null;
}
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionToUpdate.getTaskType())
.taskParams(taskDefinitionToUpdate.getTaskParams())
.dependence(taskDefinitionToUpdate.getDependence())
.build())) {
logger.warn("Task definition parameters are invalid, taskDefinitionName:{}.",
taskDefinitionToUpdate.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionToUpdate.getName());
return null;
}
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskCode);
if (version == null || version == 0) {
logger.error("Max version task definitionLog can not be found in database, taskDefinitionCode:{}.",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
taskCode);
putMsg(result, Status.DATA_IS_NOT_VALID, taskCode);
return null;
}
Date now = new Date();
taskDefinitionToUpdate.setCode(taskCode);
taskDefinitionToUpdate.setId(taskDefinition.getId());
taskDefinitionToUpdate.setProjectCode(projectCode);
taskDefinitionToUpdate.setUserId(taskDefinition.getUserId());
taskDefinitionToUpdate.setVersion(++version);
taskDefinitionToUpdate.setTaskType(taskDefinitionToUpdate.getTaskType().toUpperCase());
taskDefinitionToUpdate.setResourceIds(processService.getResourceIds(taskDefinitionToUpdate));
taskDefinitionToUpdate.setUpdateTime(now);
int update = taskDefinitionMapper.updateById(taskDefinitionToUpdate);
taskDefinitionToUpdate.setOperator(loginUser.getId());
taskDefinitionToUpdate.setOperateTime(now);
taskDefinitionToUpdate.setCreateTime(now);
taskDefinitionToUpdate.setId(null);
int insert = taskDefinitionLogMapper.insert(taskDefinitionToUpdate);
if ((update & insert) != 1) {
logger.error("Update task definition or definitionLog error, projectCode:{}, taskDefinitionCode:{}.",
projectCode, taskCode);
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
} else
logger.info(
"Update task definition and definitionLog complete, projectCode:{}, taskDefinitionCode:{}, newTaskVersion:{}.",
projectCode, taskCode, taskDefinitionToUpdate.getVersion());
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
.queryByTaskCode(taskDefinitionToUpdate.getCode());
if (CollectionUtils.isNotEmpty(processTaskRelations)) {
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (taskCode == processTaskRelation.getPreTaskCode()) {
processTaskRelation.setPreTaskVersion(version);
} else if (taskCode == processTaskRelation.getPostTaskCode()) {
processTaskRelation.setPostTaskVersion(version);
}
int count = processTaskRelationMapper.updateProcessTaskRelationTaskVersion(processTaskRelation);
if (count != 1) {
logger.error("batch update process task relation error, projectCode:{}, taskDefinitionCode:{}.",
projectCode, taskCode);
putMsg(result, Status.PROCESS_TASK_RELATION_BATCH_UPDATE_ERROR);
throw new ServiceException(Status.PROCESS_TASK_RELATION_BATCH_UPDATE_ERROR);
}
}
}
return taskDefinitionToUpdate;
}
/**
* update task definition and upstream
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task definition code
* @param taskDefinitionJsonObj task definition json object
* @param upstreamCodes upstream task codes, sep comma
* @return update result code
*/
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
public Map<String, Object> updateTaskWithUpstream(User loginUser, long projectCode, long taskCode,
String taskDefinitionJsonObj, String upstreamCodes) {
Map<String, Object> result = new HashMap<>();
TaskDefinitionLog taskDefinitionToUpdate =
updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result);
if (result.get(Constants.STATUS) != Status.SUCCESS && taskDefinitionToUpdate == null) {
return result;
}
List<ProcessTaskRelation> upstreamTaskRelations =
processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
Set<Long> upstreamCodeSet =
upstreamTaskRelations.stream().map(ProcessTaskRelation::getPreTaskCode).collect(Collectors.toSet());
Set<Long> upstreamTaskCodes = Collections.emptySet();
if (StringUtils.isNotEmpty(upstreamCodes)) {
upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong)
.collect(Collectors.toSet());
}
if (CollectionUtils.isEqualCollection(upstreamCodeSet, upstreamTaskCodes) && taskDefinitionToUpdate == null) {
putMsg(result, Status.SUCCESS);
return result;
} else {
if (taskDefinitionToUpdate == null) {
taskDefinitionToUpdate = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
}
}
Map<Long, TaskDefinition> queryUpStreamTaskCodeMap;
if (CollectionUtils.isNotEmpty(upstreamTaskCodes)) {
List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes);
queryUpStreamTaskCodeMap = upstreamTaskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinition::getCode, taskDefinition -> taskDefinition));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
upstreamTaskCodes.removeAll(queryUpStreamTaskCodeMap.keySet());
if (CollectionUtils.isNotEmpty(upstreamTaskCodes)) {
String notExistTaskCodes = StringUtils.join(upstreamTaskCodes, Constants.COMMA);
logger.error("Some task definitions in parameter upstreamTaskCodes do not exist, notExistTaskCodes:{}.",
notExistTaskCodes);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, notExistTaskCodes);
return result;
}
} else {
queryUpStreamTaskCodeMap = new HashMap<>();
}
if (CollectionUtils.isNotEmpty(upstreamTaskCodes)) {
ProcessTaskRelation taskRelation = upstreamTaskRelations.get(0);
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(projectCode, taskRelation.getProcessDefinitionCode());
List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations);
List<ProcessTaskRelation> relationList = Lists.newArrayList();
for (ProcessTaskRelation processTaskRelation : processTaskRelationList) {
if (processTaskRelation.getPostTaskCode() == taskCode) {
if (queryUpStreamTaskCodeMap.containsKey(processTaskRelation.getPreTaskCode())
&& processTaskRelation.getPreTaskCode() != 0L) {
queryUpStreamTaskCodeMap.remove(processTaskRelation.getPreTaskCode());
} else {
processTaskRelation.setPreTaskCode(0L);
processTaskRelation.setPreTaskVersion(0);
relationList.add(processTaskRelation);
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
processTaskRelationList.removeAll(relationList);
for (Map.Entry<Long, TaskDefinition> queryUpStreamTask : queryUpStreamTaskCodeMap.entrySet()) {
taskRelation.setPreTaskCode(queryUpStreamTask.getKey());
taskRelation.setPreTaskVersion(queryUpStreamTask.getValue().getVersion());
processTaskRelationList.add(taskRelation);
}
if (MapUtils.isEmpty(queryUpStreamTaskCodeMap) && CollectionUtils.isNotEmpty(processTaskRelationList)) {
processTaskRelationList.add(processTaskRelationList.get(0));
}
updateDag(loginUser, taskRelation.getProcessDefinitionCode(), processTaskRelations,
Lists.newArrayList(taskDefinitionToUpdate));
}
logger.info(
"Update task with upstream tasks complete, projectCode:{}, taskDefinitionCode:{}, upstreamTaskCodes:{}.",
projectCode, taskCode, upstreamTaskCodes);
result.put(Constants.DATA_LIST, taskCode);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* switch task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskCode task code
* @param version the version user want to switch
*/
@Transactional
@Override
public Map<String, Object> switchVersion(User loginUser, long projectCode, long taskCode, int version) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
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;
}
if (processService.isTaskOnline(taskCode)) {
logger.warn(
"Task definition version can not be switched due to process definition is {}, taskDefinitionCode:{}.",
ReleaseState.ONLINE.getDescp(), taskCode);
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
logger.error("Task definition does not exist, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode));
return result;
}
TaskDefinitionLog taskDefinitionUpdate =
taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version);
taskDefinitionUpdate.setUserId(loginUser.getId());
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
int switchVersion = taskDefinitionMapper.updateById(taskDefinitionUpdate);
if (switchVersion > 0) {
List<ProcessTaskRelation> taskRelationList =
processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode);
if (CollectionUtils.isNotEmpty(taskRelationList)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
logger.info(
"Task definition has upstream tasks, start handle them after switch task, taskDefinitionCode:{}.",
taskCode);
long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode();
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
updateDag(loginUser, processDefinitionCode, processTaskRelations,
Lists.newArrayList(taskDefinitionUpdate));
} else {
logger.info(
"Task definition version switch complete, switch task version to {}, taskDefinitionCode:{}.",
version, taskCode);
putMsg(result, Status.SUCCESS);
}
} else {
logger.error("Task definition version switch error, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.SWITCH_TASK_DEFINITION_VERSION_ERROR);
}
return result;
}
@Override
public Result queryTaskDefinitionVersions(User loginUser,
long projectCode,
long taskCode,
int pageNo,
int pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_VERSION_VIEW);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<TaskDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<TaskDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<TaskDefinitionLog> taskDefinitionVersionsPaging =
taskDefinitionLogMapper.queryTaskDefinitionVersionsPaging(page, taskCode, projectCode);
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(taskDefinitionLogs);
pageInfo.setTotal((int) taskDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public Map<String, Object> deleteByCodeAndVersion(User loginUser, long projectCode, long taskCode, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION_DELETE);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
logger.error("Task definition does not exist, taskDefinitionCode:{}.", taskCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode));
} else {
if (taskDefinition.getVersion() == version) {
logger.warn(
"Task definition can not be deleted due to version is being used, projectCode:{}, taskDefinitionCode:{}, version:{}.",
projectCode, taskCode, version);
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
int delete = taskDefinitionLogMapper.deleteByCodeAndVersion(taskCode, version);
if (delete > 0) {
logger.info(
"Task definition version delete complete, projectCode:{}, taskDefinitionCode:{}, version:{}.",
projectCode, taskCode, version);
putMsg(result, Status.SUCCESS);
} else {
logger.error("Task definition version delete error, projectCode:{}, taskDefinitionCode:{}, version:{}.",
projectCode, taskCode, version);
putMsg(result, Status.DELETE_TASK_DEFINITION_VERSION_ERROR);
}
}
return result;
}
@Override
public Map<String, Object> queryTaskDefinitionDetail(User loginUser, long projectCode, long taskCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
logger.error("Task definition does not exist, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode));
} else {
List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper
.queryByCode(projectCode, 0, 0, taskCode);
if (CollectionUtils.isNotEmpty(taskRelationList)) {
taskRelationList = taskRelationList.stream()
.filter(v -> v.getPreTaskCode() != 0).collect(Collectors.toList());
}
TaskDefinitionVo taskDefinitionVo = TaskDefinitionVo.fromTaskDefinition(taskDefinition);
taskDefinitionVo.setProcessTaskRelationList(taskRelationList);
result.put(Constants.DATA_LIST, taskDefinitionVo);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Result queryTaskDefinitionListPaging(User loginUser,
long projectCode,
String searchTaskName,
String taskType,
TaskExecuteType taskExecuteType,
Integer pageNo,
Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
taskType = taskType == null ? StringUtils.EMPTY : taskType;
Page<TaskMainInfo> page = new Page<>(pageNo, pageSize);
IPage<TaskMainInfo> taskMainInfoIPage = taskDefinitionMapper.queryDefineListPaging(page, projectCode,
searchTaskName, taskType, taskExecuteType);
fillRecords(projectCode, taskMainInfoIPage);
PageInfo<TaskMainInfo> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) taskMainInfoIPage.getTotal());
pageInfo.setTotalList(taskMainInfoIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
private void fillRecords(long projectCode, IPage<TaskMainInfo> taskMainInfoIPage) {
List<TaskMainInfo> records = Collections.emptyList();
if (CollectionUtils.isNotEmpty(taskMainInfoIPage.getRecords())) {
records = taskDefinitionMapper.queryDefineListByCodeList(projectCode,
taskMainInfoIPage.getRecords().stream().map(TaskMainInfo::getTaskCode)
.collect(Collectors.toList()));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
taskMainInfoIPage.setRecords(Collections.emptyList());
if (CollectionUtils.isNotEmpty(records)) {
Map<Long, TaskMainInfo> taskMainInfoMap = new HashMap<>();
for (TaskMainInfo info : records) {
taskMainInfoMap.compute(info.getTaskCode(), (k, v) -> {
if (v == null) {
Map<Long, String> upstreamTaskMap = new HashMap<>();
if (info.getUpstreamTaskCode() != 0) {
upstreamTaskMap.put(info.getUpstreamTaskCode(), info.getUpstreamTaskName());
info.setUpstreamTaskCode(0L);
info.setUpstreamTaskName(StringUtils.EMPTY);
}
info.setUpstreamTaskMap(upstreamTaskMap);
v = info;
}
if (info.getUpstreamTaskCode() != 0) {
v.getUpstreamTaskMap().put(info.getUpstreamTaskCode(), info.getUpstreamTaskName());
}
return v;
});
}
List<TaskMainInfo> resultRecords = Lists.newArrayList(taskMainInfoMap.values());
resultRecords.sort((o1, o2) -> o2.getTaskUpdateTime().compareTo(o1.getTaskUpdateTime()));
taskMainInfoIPage.setRecords(resultRecords);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
}
private void fillWorkflowInfo(long projectCode, IPage<TaskMainInfo> taskMainInfoIPage) {
}
@Override
public Map<String, Object> genTaskCodeList(Integer genNum) {
Map<String, Object> result = new HashMap<>();
if (genNum == null || genNum < 1 || genNum > 100) {
logger.warn("Parameter genNum must be great than 1 and less than 100.");
putMsg(result, Status.DATA_IS_NOT_VALID, genNum);
return result;
}
List<Long> taskCodes = new ArrayList<>();
try {
for (int i = 0; i < genNum; i++) {
taskCodes.add(CodeGenerateUtils.getInstance().genCode());
}
} catch (CodeGenerateException e) {
logger.error("Generate task definition code error.", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, taskCodes);
return result;
}
/**
* release task definition
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
* @param code task definition code
* @param releaseState releaseState
* @return update result code
*/
@Transactional
@Override
public Map<String, Object> releaseTaskDefinition(User loginUser, long projectCode, long code,
ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null);
Status resultStatus = (Status) result.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(code);
if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
TaskDefinitionLog taskDefinitionLog =
taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion());
if (taskDefinitionLog == null) {
logger.error("Task definition does not exist, taskDefinitionCode:{}.", code);
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
}
switch (releaseState) {
case OFFLINE:
taskDefinition.setFlag(Flag.NO);
taskDefinitionLog.setFlag(Flag.NO);
break;
case ONLINE:
String resourceIds = taskDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray =
Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,
processService, resourceIdArray, loginUser.getId(), logger);
try {
permissionCheck.checkPermission();
} catch (Exception e) {
logger.error("Resources permission check error, resourceIds:{}.", resourceIds, e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION);
return result;
}
}
taskDefinition.setFlag(Flag.YES);
taskDefinitionLog.setFlag(Flag.YES);
break;
default:
logger.warn("Parameter releaseState is invalid.");
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
int update = taskDefinitionMapper.updateById(taskDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
|
int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog);
if ((update == 0 && updateLog == 1) || (update == 1 && updateLog == 0)) {
logger.error("Update taskDefinition state or taskDefinitionLog state error, taskDefinitionCode:{}.", code);
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
logger.error("Update taskDefinition state or taskDefinitionLog state to complete, taskDefinitionCode:{}.",
code);
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public void deleteTaskByWorkflowDefinitionCode(long workflowDefinitionCode, int workflowDefinitionVersion) {
List<ProcessTaskRelation> processTaskRelations = processTaskRelationService
.queryByWorkflowDefinitionCode(workflowDefinitionCode, workflowDefinitionVersion);
if (CollectionUtils.isEmpty(processTaskRelations)) {
return;
}
Set<Long> needToDeleteTaskDefinitionCodes = new HashSet<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
needToDeleteTaskDefinitionCodes.add(processTaskRelation.getPreTaskCode());
needToDeleteTaskDefinitionCodes.add(processTaskRelation.getPostTaskCode());
}
taskDefinitionDao.deleteByTaskDefinitionCodes(needToDeleteTaskDefinitionCodes);
processTaskRelationService.deleteByWorkflowDefinitionCode(workflowDefinitionCode, workflowDefinitionVersion);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.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.
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
*/
package org.apache.dolphinscheduler.api.service;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import org.apache.dolphinscheduler.api.dto.task.TaskCreateRequest;
import org.apache.dolphinscheduler.api.dto.task.TaskUpdateRequest;
import org.apache.dolphinscheduler.api.dto.taskRelation.TaskRelationUpdateUpstreamRequest;
import org.apache.dolphinscheduler.api.dto.workflow.WorkflowUpdateRequest;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.TaskDefinitionServiceImpl;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
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.TaskDefinition;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskMainInfo;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.plugin.task.api.TaskPluginManager;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.process.ProcessServiceImpl;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ExtendWith(MockitoExtension.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
public class TaskDefinitionServiceImplTest {
@InjectMocks
private TaskDefinitionServiceImpl taskDefinitionService;
@Mock
private TaskDefinitionMapper taskDefinitionMapper;
@Mock
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProjectServiceImpl projectService;
@InjectMocks
private ProcessServiceImpl processServiceImpl;
@Mock
private ProcessService processService;
@Mock
private ProcessDefinitionLogMapper processDefineLogMapper;
@Mock
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Mock
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
private ProcessTaskRelationMapper processTaskRelationMapper;
@Mock
private TaskPluginManager taskPluginManager;
@Mock
private ProcessTaskRelationService processTaskRelationService;
@Mock
private ProcessDefinitionMapper processDefinitionMapper;
@Mock
private ProcessDefinitionService processDefinitionService;
private static final String TASK_PARAMETER =
"{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}";;
private static final long PROJECT_CODE = 1L;
private static final long PROCESS_DEFINITION_CODE = 2L;
private static final long TASK_CODE = 3L;
private static final int VERSION = 1;
private static final int RESOURCE_RATE = -1;
protected User user;
protected Exception exception;
@BeforeEach
public void before() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setTenantId(2);
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setUserName("admin");
user = loginUser;
}
@Test
public void createTaskDefinition() {
Project project = getProject();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, PROJECT_CODE);
Mockito.when(projectService.checkProjectAndAuth(user, project, PROJECT_CODE, TASK_DEFINITION_CREATE))
.thenReturn(result);
String createTaskDefinitionJson =
"[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":"
+ "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\","
+ "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":"
+ "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"],"
+ "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0,"
+ "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0,"
+ "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]";
Map<String, Object> relation = taskDefinitionService
.createTaskDefinition(user, PROJECT_CODE, createTaskDefinitionJson);
Assertions.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS));
}
@Test
public void updateTaskDefinition() {
String taskDefinitionJson =
"{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":"
+ "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\","
+ "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":"
+ "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"],"
+ "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0,"
+ "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0,"
+ "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}";
Project project = getProject();
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
Map<String, Object> result = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
putMsg(result, Status.SUCCESS, PROJECT_CODE);
Mockito.when(projectService.hasProjectAndWritePerm(user, project, new HashMap<>())).thenReturn(true);
Mockito.when(processService.isTaskOnline(TASK_CODE)).thenReturn(Boolean.FALSE);
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE)).thenReturn(new TaskDefinition());
Mockito.when(taskDefinitionMapper.updateById(Mockito.any(TaskDefinitionLog.class))).thenReturn(1);
Mockito.when(taskDefinitionLogMapper.insert(Mockito.any(TaskDefinitionLog.class))).thenReturn(1);
Mockito.when(taskDefinitionLogMapper.queryMaxVersionForDefinition(TASK_CODE)).thenReturn(1);
Mockito.when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true);
Mockito.when(processTaskRelationMapper.queryByTaskCode(3)).thenReturn(getProcessTaskRelationList2());
Mockito.when(processTaskRelationMapper
.updateProcessTaskRelationTaskVersion(Mockito.any(ProcessTaskRelation.class))).thenReturn(1);
result = taskDefinitionService.updateTaskDefinition(user, PROJECT_CODE, TASK_CODE, taskDefinitionJson);
Assertions.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Mockito.when(processTaskRelationMapper
.updateProcessTaskRelationTaskVersion(Mockito.any(ProcessTaskRelation.class))).thenReturn(2);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinition(user, PROJECT_CODE, TASK_CODE, taskDefinitionJson));
Assertions.assertEquals(Status.PROCESS_TASK_RELATION_BATCH_UPDATE_ERROR.getCode(),
((ServiceException) exception).getCode());
}
@Test
public void queryTaskDefinitionByName() {
String taskName = "task";
Project project = getProject();
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, PROJECT_CODE);
Mockito.when(projectService.checkProjectAndAuth(user, project, PROJECT_CODE, TASK_DEFINITION))
.thenReturn(result);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
Mockito.when(taskDefinitionMapper.queryByName(project.getCode(), PROCESS_DEFINITION_CODE, taskName))
.thenReturn(new TaskDefinition());
Map<String, Object> relation = taskDefinitionService
.queryTaskDefinitionByName(user, PROJECT_CODE, PROCESS_DEFINITION_CODE, taskName);
Assertions.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS));
}
@Test
public void deleteTaskDefinitionByCode() {
Project project = getProject();
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.deleteTaskDefinitionByCode(user, TASK_CODE));
Assertions.assertEquals(Status.TASK_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE)).thenReturn(getTaskDefinition());
Mockito.when(taskDefinitionMapper.deleteByCode(TASK_CODE)).thenReturn(0);
Mockito.when(projectService.hasProjectAndWritePerm(user, project, new HashMap<>())).thenReturn(true);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.deleteTaskDefinitionByCode(user, TASK_CODE));
Assertions.assertEquals(Status.DELETE_TASK_DEFINE_BY_CODE_MSG_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, project,
TASK_DEFINITION_DELETE);
Mockito.when(processTaskRelationMapper.queryDownstreamByTaskCode(TASK_CODE)).thenReturn(new ArrayList<>());
Mockito.when(taskDefinitionMapper.deleteByCode(TASK_CODE)).thenReturn(1);
Assertions.assertDoesNotThrow(() -> taskDefinitionService.deleteTaskDefinitionByCode(user, TASK_CODE));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
public void switchVersion() {
Project project = getProject();
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, PROJECT_CODE);
Mockito.when(
projectService.checkProjectAndAuth(user, project, PROJECT_CODE, WORKFLOW_SWITCH_TO_THIS_VERSION))
.thenReturn(result);
Mockito.when(taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(TASK_CODE, VERSION))
.thenReturn(new TaskDefinitionLog());
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setProjectCode(PROJECT_CODE);
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE))
.thenReturn(taskDefinition);
Mockito.when(taskDefinitionMapper.updateById(new TaskDefinitionLog())).thenReturn(1);
Map<String, Object> relation = taskDefinitionService
.switchVersion(user, PROJECT_CODE, TASK_CODE, VERSION);
Assertions.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS));
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
}
}
@Test
public void checkJson() {
String taskDefinitionJson =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
"[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":"
+ "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\","
+ "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":"
+ "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"],"
+ "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0,"
+ "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0,"
+ "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]";
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Assertions.assertFalse(taskDefinitionLogs.isEmpty());
String taskJson =
"[{\"name\":\"shell1\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
+ "\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},"
+ "\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\","
+ "\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"},{\"name\":\"shell2\",\"description\":\"\","
+ "\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"conditionResult\":{\"successNode\""
+ ":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\","
+ "\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\",\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"}]";
taskDefinitionLogs = JSONUtils.toList(taskJson, TaskDefinitionLog.class);
Assertions.assertFalse(taskDefinitionLogs.isEmpty());
String taskParams =
"{\"resourceList\":[],\"localParams\":[{\"prop\":\"datetime\",\"direct\":\"IN\",\"type\":\"VARCHAR\","
+ "\"value\":\"${system.datetime}\"}],\"rawScript\":\"echo ${datetime}\",\"conditionResult\":\"{\\\"successNode\\\":[\\\"\\\"],"
+ "\\\"failedNode\\\":[\\\"\\\"]}\",\"dependence\":{}}";
Map parameters = JSONUtils.parseObject(taskParams, Map.class);
Assertions.assertNotNull(parameters);
String params =
"{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}";
Map parameters1 = JSONUtils.parseObject(params, Map.class);
Assertions.assertNotNull(parameters1);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
@Test
public void genTaskCodeList() {
Map<String, Object> genTaskCodeList = taskDefinitionService.genTaskCodeList(10);
Assertions.assertEquals(Status.SUCCESS, genTaskCodeList.get(Constants.STATUS));
}
@Test
public void testQueryTaskDefinitionListPaging() {
Project project = getProject();
Map<String, Object> checkResult = new HashMap<>();
checkResult.put(Constants.STATUS, Status.SUCCESS);
Integer pageNo = 1;
Integer pageSize = 10;
IPage<TaskMainInfo> taskMainInfoIPage = new Page<>();
TaskMainInfo taskMainInfo = new TaskMainInfo();
taskMainInfo.setTaskCode(TASK_CODE);
taskMainInfo.setUpstreamTaskCode(4L);
taskMainInfo.setUpstreamTaskName("4");
taskMainInfoIPage.setRecords(Collections.singletonList(taskMainInfo));
taskMainInfoIPage.setTotal(10L);
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(project);
Mockito.when(projectService.checkProjectAndAuth(user, project, PROJECT_CODE, TASK_DEFINITION))
.thenReturn(checkResult);
Mockito.when(taskDefinitionMapper.queryDefineListPaging(Mockito.any(Page.class), Mockito.anyLong(),
Mockito.isNull(), Mockito.anyString(), Mockito.isNull()))
.thenReturn(taskMainInfoIPage);
Mockito.when(taskDefinitionMapper.queryDefineListByCodeList(PROJECT_CODE, Collections.singletonList(3L)))
.thenReturn(Collections.singletonList(taskMainInfo));
Result result = taskDefinitionService.queryTaskDefinitionListPaging(user, PROJECT_CODE,
null, null, null, pageNo, pageSize);
Assertions.assertEquals(Status.SUCCESS.getMsg(), result.getMsg());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
}
@Test
public void testReleaseTaskDefinition() {
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(getProject());
Project project = getProject();
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, TASK_CODE);
Mockito.when(projectService.checkProjectAndAuth(user, project, PROJECT_CODE, null)).thenReturn(result);
Map<String, Object> map =
taskDefinitionService.releaseTaskDefinition(user, PROJECT_CODE, TASK_CODE, ReleaseState.OFFLINE);
Assertions.assertEquals(Status.TASK_DEFINE_NOT_EXIST, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS);
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setProjectCode(PROJECT_CODE);
taskDefinition.setVersion(1);
taskDefinition.setCode(TASK_CODE);
String params =
"{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}";
taskDefinition.setTaskParams(params);
taskDefinition.setTaskType("SHELL");
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE)).thenReturn(taskDefinition);
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
Mockito.when(taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(TASK_CODE, taskDefinition.getVersion()))
.thenReturn(taskDefinitionLog);
Map<String, Object> offlineTaskResult =
taskDefinitionService.releaseTaskDefinition(user, PROJECT_CODE, TASK_CODE, ReleaseState.OFFLINE);
Assertions.assertEquals(Status.SUCCESS, offlineTaskResult.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
Map<String, Object> onlineTaskResult =
taskDefinitionService.releaseTaskDefinition(user, PROJECT_CODE, TASK_CODE, ReleaseState.ONLINE);
Assertions.assertEquals(Status.SUCCESS, onlineTaskResult.get(Constants.STATUS));
Map<String, Object> failResult =
taskDefinitionService.releaseTaskDefinition(user, PROJECT_CODE, TASK_CODE, ReleaseState.getEnum(2));
Assertions.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failResult.get(Constants.STATUS));
}
@Test
public void testCreateTaskDefinitionV2() {
TaskCreateRequest taskCreateRequest = new TaskCreateRequest();
taskCreateRequest.setProjectCode(PROJECT_CODE);
taskCreateRequest.setWorkflowCode(PROCESS_DEFINITION_CODE);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.when(processDefinitionMapper.queryByCode(PROCESS_DEFINITION_CODE)).thenReturn(getProcessDefinition());
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(getProject());
Mockito.doThrow(new ServiceException(Status.PROJECT_NOT_EXIST)).when(projectService)
.checkProjectAndAuthThrowException(user, getProject(), TASK_DEFINITION_CREATE);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
Assertions.assertEquals(Status.PROJECT_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
taskCreateRequest.setTaskParams(TASK_PARAMETER);
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, getProject(),
TASK_DEFINITION_CREATE);
exception = Assertions.assertThrows(ServiceException.class,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
Assertions.assertEquals(Status.PROCESS_NODE_S_PARAMETER_INVALID.getCode(),
((ServiceException) exception).getCode());
Mockito.when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true);
Mockito.when(taskDefinitionMapper.insert(isA(TaskDefinition.class))).thenReturn(0);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
Assertions.assertEquals(Status.CREATE_TASK_DEFINITION_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.when(taskDefinitionMapper.insert(isA(TaskDefinition.class))).thenReturn(1);
Mockito.when(taskDefinitionLogMapper.insert(isA(TaskDefinitionLog.class))).thenReturn(0);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
Assertions.assertEquals(Status.CREATE_TASK_DEFINITION_LOG_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.when(taskDefinitionLogMapper.insert(isA(TaskDefinitionLog.class))).thenReturn(1);
Mockito.when(
processTaskRelationService.updateUpstreamTaskDefinitionWithSyncDag(isA(User.class), isA(Long.class),
isA(Boolean.class),
isA(TaskRelationUpdateUpstreamRequest.class)))
.thenReturn(getProcessTaskRelationList());
Mockito.when(processDefinitionService.updateSingleProcessDefinition(isA(User.class), isA(Long.class),
isA(WorkflowUpdateRequest.class))).thenReturn(getProcessDefinition());
Assertions.assertDoesNotThrow(() -> taskDefinitionService.createTaskDefinitionV2(user, taskCreateRequest));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
public void testUpdateTaskDefinitionV2() {
TaskUpdateRequest taskUpdateRequest = new TaskUpdateRequest();
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.TASK_DEFINITION_NOT_EXISTS.getCode(), ((ServiceException) exception).getCode());
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE)).thenReturn(getTaskDefinition());
Mockito.when(projectMapper.queryByCode(isA(Long.class))).thenReturn(getProject());
Mockito.doThrow(new ServiceException(Status.PROJECT_NOT_EXIST)).when(projectService)
.checkProjectAndAuthThrowException(user, getProject(), TASK_DEFINITION_UPDATE);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.PROJECT_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, getProject(),
TASK_DEFINITION_UPDATE);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.PROCESS_NODE_S_PARAMETER_INVALID.getCode(),
((ServiceException) exception).getCode());
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.PROCESS_NODE_S_PARAMETER_INVALID.getCode(),
((ServiceException) exception).getCode());
Mockito.when(processService.isTaskOnline(TASK_CODE)).thenReturn(false);
Mockito.when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true);
exception = Assertions.assertThrows(ServiceException.class,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.TASK_DEFINITION_NOT_CHANGE.getCode(), ((ServiceException) exception).getCode());
taskUpdateRequest.setTaskPriority(String.valueOf(Priority.HIGH));
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.DATA_IS_NOT_VALID.getCode(), ((ServiceException) exception).getCode());
Mockito.when(taskDefinitionLogMapper.queryMaxVersionForDefinition(TASK_CODE)).thenReturn(VERSION);
Mockito.when(taskDefinitionMapper.updateById(isA(TaskDefinition.class))).thenReturn(0);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.UPDATE_TASK_DEFINITION_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.when(taskDefinitionMapper.updateById(isA(TaskDefinition.class))).thenReturn(1);
Mockito.when(taskDefinitionLogMapper.insert(isA(TaskDefinitionLog.class))).thenReturn(0);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
Assertions.assertEquals(Status.CREATE_TASK_DEFINITION_LOG_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.when(taskDefinitionLogMapper.insert(isA(TaskDefinitionLog.class))).thenReturn(1);
Mockito.when(
processTaskRelationService.updateUpstreamTaskDefinitionWithSyncDag(isA(User.class), isA(Long.class),
isA(Boolean.class),
isA(TaskRelationUpdateUpstreamRequest.class)))
.thenReturn(getProcessTaskRelationList());
Assertions.assertDoesNotThrow(
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
() -> taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest));
TaskDefinition taskDefinition =
taskDefinitionService.updateTaskDefinitionV2(user, TASK_CODE, taskUpdateRequest);
Assertions.assertEquals(getTaskDefinition().getVersion() + 1, taskDefinition.getVersion());
}
@Test
public void testUpdateDag() {
User loginUser = getLoginUser();
ProcessDefinition processDefinition = getProcessDefinition();
processDefinition.setId(null);
List<ProcessTaskRelation> processTaskRelationList = getProcessTaskRelationList();
TaskDefinitionLog taskDefinitionLog = getTaskDefinitionLog();
ArrayList<TaskDefinitionLog> taskDefinitionLogs = new ArrayList<>();
taskDefinitionLogs.add(taskDefinitionLog);
Integer version = 1;
Mockito.when(processDefinitionMapper.queryByCode(isA(long.class))).thenReturn(processDefinition);
Mockito.when(processDefineLogMapper.queryMaxVersionForDefinition(isA(long.class))).thenReturn(version);
Mockito.when(processDefineLogMapper.insert(isA(ProcessDefinitionLog.class))).thenReturn(1);
Mockito.when(processDefinitionMapper.insert(isA(ProcessDefinitionLog.class))).thenReturn(1);
int insertVersion =
processServiceImpl.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
Mockito.when(processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE))
.thenReturn(insertVersion);
Assertions.assertEquals(insertVersion, version + 1);
List<ProcessTaskRelationLog> processTaskRelationLogList = getProcessTaskRelationLogList();
Mockito.when(processTaskRelationMapper.queryByProcessCode(eq(processDefinition.getProjectCode()),
eq(processDefinition.getCode()))).thenReturn(processTaskRelationList);
Mockito.when(processTaskRelationMapper.batchInsert(isA(List.class))).thenReturn(1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
Mockito.when(processTaskRelationLogMapper.batchInsert(isA(List.class))).thenReturn(1);
int insertResult = processServiceImpl.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, processTaskRelationLogList, taskDefinitionLogs,
Boolean.TRUE);
Assertions.assertEquals(Constants.EXIT_CODE_SUCCESS, insertResult);
Assertions.assertDoesNotThrow(
() -> taskDefinitionService.updateDag(loginUser, processDefinition.getCode(), processTaskRelationList,
taskDefinitionLogs));
}
@Test
public void testGetTaskDefinition() {
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.getTaskDefinition(user, TASK_CODE));
Assertions.assertEquals(Status.TASK_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.when(taskDefinitionMapper.queryByCode(TASK_CODE)).thenReturn(getTaskDefinition());
Mockito.when(projectMapper.queryByCode(PROJECT_CODE)).thenReturn(getProject());
Mockito.doThrow(new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM)).when(projectService)
.checkProjectAndAuthThrowException(user, getProject(), TASK_DEFINITION);
exception = Assertions.assertThrows(ServiceException.class,
() -> taskDefinitionService.getTaskDefinition(user, TASK_CODE));
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM.getCode(),
((ServiceException) exception).getCode());
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, getProject(), TASK_DEFINITION);
Assertions.assertDoesNotThrow(() -> taskDefinitionService.getTaskDefinition(user, TASK_CODE));
}
/**
* create admin user
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
*/
private User getLoginUser() {
User loginUser = new User();
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setUserName("admin");
loginUser.setId(1);
return loginUser;
}
/**
* get mock Project
*
* @return Project
*/
private Project getProject() {
Project project = new Project();
project.setId(1);
project.setCode(PROJECT_CODE);
project.setName("test");
project.setUserId(1);
return project;
}
private ProcessDefinition getProcessDefinition() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setProjectCode(PROJECT_CODE);
processDefinition.setCode(PROCESS_DEFINITION_CODE);
processDefinition.setVersion(VERSION);
return processDefinition;
}
private TaskDefinition getTaskDefinition() {
TaskDefinition taskDefinition = new TaskDefinition();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
taskDefinition.setProjectCode(PROJECT_CODE);
taskDefinition.setCode(TASK_CODE);
taskDefinition.setVersion(VERSION);
taskDefinition.setTaskType("SHELL");
taskDefinition.setTaskParams(TASK_PARAMETER);
taskDefinition.setFlag(Flag.YES);
taskDefinition.setCpuQuota(RESOURCE_RATE);
taskDefinition.setMemoryMax(RESOURCE_RATE);
return taskDefinition;
}
private TaskDefinitionLog getTaskDefinitionLog() {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog();
taskDefinitionLog.setProjectCode(PROJECT_CODE);
taskDefinitionLog.setCode(TASK_CODE);
taskDefinitionLog.setVersion(VERSION);
taskDefinitionLog.setTaskType("SHELL");
taskDefinitionLog.setTaskParams(TASK_PARAMETER);
taskDefinitionLog.setFlag(Flag.YES);
taskDefinitionLog.setCpuQuota(RESOURCE_RATE);
taskDefinitionLog.setMemoryMax(RESOURCE_RATE);
return taskDefinitionLog;
}
private List<ProcessTaskRelation> getProcessTaskRelationList() {
List<ProcessTaskRelation> processTaskRelationList = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(PROJECT_CODE);
processTaskRelation.setProcessDefinitionCode(PROCESS_DEFINITION_CODE);
processTaskRelation.setPreTaskCode(TASK_CODE);
processTaskRelation.setPostTaskCode(TASK_CODE + 1L);
processTaskRelationList.add(processTaskRelation);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
|
return processTaskRelationList;
}
private List<ProcessTaskRelationLog> getProcessTaskRelationLogList() {
List<ProcessTaskRelationLog> processTaskRelationLogList = new ArrayList<>();
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog();
processTaskRelationLog.setProjectCode(PROJECT_CODE);
processTaskRelationLog.setProcessDefinitionCode(PROCESS_DEFINITION_CODE);
processTaskRelationLog.setPreTaskCode(TASK_CODE);
processTaskRelationLog.setPostTaskCode(TASK_CODE + 1L);
processTaskRelationLogList.add(processTaskRelationLog);
return processTaskRelationLogList;
}
private List<ProcessTaskRelation> getProcessTaskRelationList2() {
List<ProcessTaskRelation> processTaskRelationList = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(PROJECT_CODE);
processTaskRelation.setProcessDefinitionCode(PROCESS_DEFINITION_CODE);
processTaskRelation.setPreTaskCode(TASK_CODE);
processTaskRelation.setPostTaskCode(TASK_CODE + 1L);
processTaskRelationList.add(processTaskRelation);
ProcessTaskRelation processTaskRelation2 = new ProcessTaskRelation();
processTaskRelation2.setProjectCode(PROJECT_CODE);
processTaskRelation2.setProcessDefinitionCode(PROCESS_DEFINITION_CODE);
processTaskRelation2.setPreTaskCode(TASK_CODE - 1);
processTaskRelation2.setPostTaskCode(TASK_CODE);
processTaskRelationList.add(processTaskRelation2);
return processTaskRelationList;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/repository/ProcessTaskRelationLogDao.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.repository;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import java.util.List;
public interface ProcessTaskRelationLogDao {
List<ProcessTaskRelationLog> findByWorkflowDefinitionCode(long workflowDefinitionCode);
void deleteByWorkflowDefinitionCode(long workflowDefinitionCode);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/repository/impl/ProcessTaskRelationLogDaoImpl.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.repository.impl;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.repository.ProcessTaskRelationLogDao;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,066 |
[Bug] [dolphinscheduler-api] in the task definition list, can't just modify upstream task list
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list, can't just modify upstream task list
### What you expected to happen
can modify
### How to reproduce
in the task definition list, select edit, just modify upstream task list
### 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/13066
|
https://github.com/apache/dolphinscheduler/pull/12722
|
a843e0b96d10dc23907318479b385b95038bcd4d
|
8439b5dc69f2a7dfc1043393bbbb21a8277715da
| 2022-12-01T03:09:05Z |
java
| 2023-01-15T11:58:47Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/repository/impl/ProcessTaskRelationLogDaoImpl.java
|
public class ProcessTaskRelationLogDaoImpl implements ProcessTaskRelationLogDao {
@Autowired
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Override
public List<ProcessTaskRelationLog> findByWorkflowDefinitionCode(long workflowDefinitionCode) {
return processTaskRelationLogMapper.queryByProcessCode(workflowDefinitionCode);
}
@Override
public void deleteByWorkflowDefinitionCode(long workflowDefinitionCode) {
processTaskRelationLogMapper.deleteByWorkflowDefinitionCode(workflowDefinitionCode);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,421 |
[Bug] [dolphinscheduler-api] in the task definition list, when the task details are not modified, the predecessor node cannot be modified
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
in the task definition list,
edit node,
the task detail are not modify, only the process pre code for modify
### What you expected to happen
the task detail are not modify, only the process pre code for modify
### How to reproduce
in the task definition list,
edit node,
the task detail are not modify, only the process pre code for modify
### 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/13421
|
https://github.com/apache/dolphinscheduler/pull/13422
|
8be32d4145c851a01d7300cd5a854be9b4a27055
|
3b54de0c90083aaf0857362e7c237fb85ba3976c
| 2023-01-18T05:48:15Z |
java
| 2023-01-18T12:08:28Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.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.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_UPDATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_VERSION_VIEW;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION;
import org.apache.dolphinscheduler.api.dto.task.TaskCreateRequest;
import org.apache.dolphinscheduler.api.dto.task.TaskFilterRequest;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.