Skip to content

Commit

Permalink
bugfix: 修复文件分发任务执行失败的问题 TencentBlueKing#21
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleryuwang committed Jul 2, 2021
1 parent bed9a4b commit bc5e519
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Expand Up @@ -37,16 +37,33 @@
import com.tencent.bk.job.execute.engine.model.TaskVariablesAnalyzeResult;
import com.tencent.bk.job.execute.engine.result.ResultHandleManager;
import com.tencent.bk.job.execute.engine.result.ha.ResultHandleTaskKeepaliveManager;
import com.tencent.bk.job.execute.model.*;
import com.tencent.bk.job.execute.model.AccountDTO;
import com.tencent.bk.job.execute.model.GseTaskIpLogDTO;
import com.tencent.bk.job.execute.model.GseTaskLogDTO;
import com.tencent.bk.job.execute.model.StepInstanceDTO;
import com.tencent.bk.job.execute.model.StepInstanceVariableValuesDTO;
import com.tencent.bk.job.execute.model.TaskInstanceDTO;
import com.tencent.bk.job.execute.monitor.metrics.ExecuteMonitor;
import com.tencent.bk.job.execute.monitor.metrics.GseTasksExceptionCounter;
import com.tencent.bk.job.execute.service.*;
import com.tencent.bk.job.execute.service.AccountService;
import com.tencent.bk.job.execute.service.AgentService;
import com.tencent.bk.job.execute.service.GseTaskLogService;
import com.tencent.bk.job.execute.service.LogService;
import com.tencent.bk.job.execute.service.StepInstanceVariableValueService;
import com.tencent.bk.job.execute.service.TaskInstanceService;
import com.tencent.bk.job.execute.service.TaskInstanceVariableService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.StopWatch;

import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* GSE任务执行基础类
Expand Down Expand Up @@ -263,7 +280,7 @@ protected GseTaskIpLogDTO buildGseTaskIpLog(String cloudAreaIdAndIp, IpStatus st

protected Map<String, String> buildReferenceGlobalVarValueMap(StepInstanceVariableValuesDTO stepInputVariables) {
Map<String, String> globalVarValueMap = new HashMap<>();
if (CollectionUtils.isEmpty(stepInputVariables.getGlobalParams())) {
if (stepInputVariables == null || CollectionUtils.isEmpty(stepInputVariables.getGlobalParams())) {
return globalVarValueMap;
}
stepInputVariables.getGlobalParams().forEach(globalParam -> {
Expand Down
Expand Up @@ -81,14 +81,14 @@ public void handleMessage(@Payload StepControlMessage gseStepControlMessage,
} else {
log.error("Error gse step control action:{}", action);
}
} catch (Exception e) {
} catch (Throwable e) {
String errorMsg = "Handling gse step control message error,stepInstanceId:" + stepInstanceId;
log.warn(errorMsg, e);
log.error(errorMsg, e);
handleException(e);
}
}

private void handleException(Exception e) throws MessageHandleException {
private void handleException(Throwable e) throws MessageHandleException {
// 服务关闭,消息被拒绝,重新入队列
if (e instanceof MessageHandlerUnavailableException) {
throw (MessageHandlerUnavailableException) e;
Expand Down

0 comments on commit bc5e519

Please sign in to comment.