|
|
@@ -2,7 +2,7 @@ package cn.reghao.autodop.dmaster.app.service.deploy;
|
|
|
|
|
|
import cn.reghao.autodop.common.amqp.MQMessage;
|
|
|
import cn.reghao.autodop.common.amqp.MessageType;
|
|
|
-import cn.reghao.autodop.common.amqp.RPCResult;
|
|
|
+import cn.reghao.autodop.common.amqp.RpcResult;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.AppOps;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.data.deploy.AppDeployArgs;
|
|
|
import cn.reghao.autodop.common.amqp.RabbitProducer;
|
|
|
@@ -12,7 +12,6 @@ import cn.reghao.autodop.dmaster.app.entity.deploy.DeployConfig;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.BuildLog;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.DeployLog;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.DeployResult;
|
|
|
-import cn.reghao.autodop.dmaster.cluster.repository.MachineRegistryRepository;
|
|
|
import cn.reghao.autodop.dmaster.common.exception.ExceptionUtil;
|
|
|
import cn.reghao.autodop.dmaster.common.thread.ThreadPoolWrapper;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -48,7 +47,7 @@ public class AppDeployer {
|
|
|
* @date 2020-03-13 下午1:00
|
|
|
*/
|
|
|
public DeployResult deploy(BuildLog buildLog, List<DeployConfig> deployConfigs) {
|
|
|
- Map<String, Future<RPCResult>> futureMap = new HashMap<>(deployConfigs.size());
|
|
|
+ Map<String, Future<RpcResult>> futureMap = new HashMap<>(deployConfigs.size());
|
|
|
for (DeployConfig deployConfig : deployConfigs) {
|
|
|
AppDeployArgs appDeployArgs = new AppDeployArgs();
|
|
|
appDeployArgs.setAppId(buildLog.getAppId());
|
|
|
@@ -70,8 +69,8 @@ public class AppDeployer {
|
|
|
LocalDateTime deployTime = LocalDateTime.now();
|
|
|
deployResult.setDeployTime(deployTime);
|
|
|
List<DeployLog> deployLogs = new ArrayList<>();
|
|
|
- for (Map.Entry<String, Future<RPCResult>> entry : futureMap.entrySet()) {
|
|
|
- Future<RPCResult> future = entry.getValue();
|
|
|
+ for (Map.Entry<String, Future<RpcResult>> entry : futureMap.entrySet()) {
|
|
|
+ Future<RpcResult> future = entry.getValue();
|
|
|
while (!future.isDone() && !future.isCancelled()) {
|
|
|
// 休眠等待异步任务结束
|
|
|
try {
|
|
|
@@ -87,7 +86,7 @@ public class AppDeployer {
|
|
|
deployLog.setCommitId(buildLog.getCommitId());
|
|
|
deployLog.setMachineId(entry.getKey());
|
|
|
try {
|
|
|
- RPCResult rpcResult = future.get();
|
|
|
+ RpcResult rpcResult = future.get();
|
|
|
if (rpcResult != null) {
|
|
|
deployLog.setDeployTime(deployTime);
|
|
|
deployLog.setStatusCode(rpcResult.getStatusCode());
|
|
|
@@ -106,7 +105,7 @@ public class AppDeployer {
|
|
|
return deployResult;
|
|
|
}
|
|
|
|
|
|
- class DeployTask implements Callable<RPCResult> {
|
|
|
+ class DeployTask implements Callable<RpcResult> {
|
|
|
private String machineId;
|
|
|
private AppDeployArgs appDeployArgs;
|
|
|
|
|
|
@@ -116,7 +115,7 @@ public class AppDeployer {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RPCResult call() {
|
|
|
+ public RpcResult call() {
|
|
|
MQMessage mqMessage = new MQMessage();
|
|
|
mqMessage.setMachineId(machineId);
|
|
|
mqMessage.setSendTime(System.currentTimeMillis());
|