Unverified Commit cc604704 authored by gaoyan's avatar gaoyan Committed by GitHub

[Fix] Fixed the issue that the address of the jobmanager was not changed in…

[Fix] Fixed the issue that the address of the jobmanager was not changed in modify cluster instance (#3070) Co-authored-by: 's avatargaoyan1998 <gaoyan1998@users.noreply.github.com>
parent 717214f6
...@@ -28,6 +28,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -28,6 +28,7 @@ import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -40,6 +41,7 @@ import lombok.NoArgsConstructor; ...@@ -40,6 +41,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(value = "ClusterInstanceDTO", description = "API Cluster Instance Data Transfer Object") @ApiModel(value = "ClusterInstanceDTO", description = "API Cluster Instance Data Transfer Object")
@Builder
public class ClusterInstanceDTO { public class ClusterInstanceDTO {
@ApiModelProperty(value = "id", required = true, dataType = "Integer", example = "id") @ApiModelProperty(value = "id", required = true, dataType = "Integer", example = "id")
...@@ -67,14 +69,6 @@ public class ClusterInstanceDTO { ...@@ -67,14 +69,6 @@ public class ClusterInstanceDTO {
@ApiModelProperty(value = "hosts", required = true, dataType = "String", example = "test", notes = "cluster hosts") @ApiModelProperty(value = "hosts", required = true, dataType = "String", example = "test", notes = "cluster hosts")
private String hosts; private String hosts;
@ApiModelProperty(
value = "jobManagerHost",
required = true,
dataType = "String",
example = "test",
notes = "job manager host")
private String jobManagerHost;
@ApiModelProperty( @ApiModelProperty(
value = "autoRegisters", value = "autoRegisters",
required = true, required = true,
...@@ -105,18 +99,4 @@ public class ClusterInstanceDTO { ...@@ -105,18 +99,4 @@ public class ClusterInstanceDTO {
BeanUtil.copyProperties(this, clusterInstance); BeanUtil.copyProperties(this, clusterInstance);
return clusterInstance; return clusterInstance;
} }
public static ClusterInstanceDTO autoRegistersClusterDTO(
String hosts, String name, String alias, String type, Integer clusterConfigurationId, Integer taskId) {
ClusterInstanceDTO clusterInstanceDTO = new ClusterInstanceDTO();
clusterInstanceDTO.setName(name);
clusterInstanceDTO.setAlias(alias);
clusterInstanceDTO.setHosts(hosts);
clusterInstanceDTO.setType(type);
clusterInstanceDTO.setClusterConfigurationId(clusterConfigurationId);
clusterInstanceDTO.setTaskId(taskId);
clusterInstanceDTO.setAutoRegisters(true);
clusterInstanceDTO.setEnabled(true);
return clusterInstanceDTO;
}
} }
...@@ -111,18 +111,4 @@ public class ClusterInstance extends SuperEntity<ClusterInstance> { ...@@ -111,18 +111,4 @@ public class ClusterInstance extends SuperEntity<ClusterInstance> {
@ApiModelProperty(value = "taskId", required = true, dataType = "Integer", example = "test", notes = "task id") @ApiModelProperty(value = "taskId", required = true, dataType = "Integer", example = "test", notes = "task id")
private Integer taskId; private Integer taskId;
public static ClusterInstance autoRegistersCluster(
String hosts, String name, String alias, String type, Integer clusterConfigurationId, Integer taskId) {
ClusterInstance clusterInstance = new ClusterInstance();
clusterInstance.setName(name);
clusterInstance.setAlias(alias);
clusterInstance.setHosts(hosts);
clusterInstance.setType(type);
clusterInstance.setClusterConfigurationId(clusterConfigurationId);
clusterInstance.setTaskId(taskId);
clusterInstance.setAutoRegisters(true);
clusterInstance.setEnabled(true);
return clusterInstance;
}
} }
...@@ -132,26 +132,32 @@ public class Job2MysqlHandler extends AbsJobHandler { ...@@ -132,26 +132,32 @@ public class Job2MysqlHandler extends AbsJobHandler {
ClusterInstance clusterInstance; ClusterInstance clusterInstance;
final Integer clusterConfigurationId = job.getJobConfig().getClusterConfigurationId(); final Integer clusterConfigurationId = job.getJobConfig().getClusterConfigurationId();
if (job.isUseGateway()) { if (job.isUseGateway()) {
clusterInstance = clusterInstanceService.registersCluster(ClusterInstanceDTO.autoRegistersClusterDTO( clusterInstance = clusterInstanceService.registersCluster(ClusterInstanceDTO.builder()
job.getJobManagerAddress(), .hosts(job.getJobManagerAddress())
job.getJobId(), .name(job.getJobId())
job.getJobConfig().getJobName() + "_" + LocalDateTime.now(), .alias(job.getJobConfig().getJobName() + "_" + LocalDateTime.now())
job.getType().getLongValue(), .type(job.getType().getLongValue())
clusterConfigurationId, .clusterConfigurationId(clusterConfigurationId)
taskId)); .taskId(taskId)
.autoRegisters(true)
.enabled(true)
.build());
if (Asserts.isNotNull(clusterInstance)) { if (Asserts.isNotNull(clusterInstance)) {
clusterId = clusterInstance.getId(); clusterId = clusterInstance.getId();
} }
} else if (GatewayType.LOCAL.equalsValue(job.getJobConfig().getType()) } else if (GatewayType.LOCAL.equalsValue(job.getJobConfig().getType())
&& Asserts.isNotNullString(job.getJobManagerAddress()) && Asserts.isNotNullString(job.getJobManagerAddress())
&& Asserts.isNotNullString(job.getJobId())) { && Asserts.isNotNullString(job.getJobId())) {
clusterInstance = clusterInstanceService.registersCluster(ClusterInstanceDTO.autoRegistersClusterDTO( clusterInstance = clusterInstanceService.registersCluster(ClusterInstanceDTO.builder()
job.getJobManagerAddress(), .hosts(job.getJobManagerAddress())
job.getJobId(), .name(job.getJobId())
job.getJobConfig().getJobName() + "_" + LocalDateTime.now(), .alias(job.getJobConfig().getJobName() + "_" + LocalDateTime.now())
job.getType().getLongValue(), .type(job.getType().getLongValue())
null, .taskId(taskId)
taskId)); .autoRegisters(true)
.enabled(true)
.build());
if (Asserts.isNotNull(clusterInstance)) { if (Asserts.isNotNull(clusterInstance)) {
clusterId = clusterInstance.getId(); clusterId = clusterInstance.getId();
} }
......
...@@ -233,13 +233,15 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance ...@@ -233,13 +233,15 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
GatewayResult gatewayResult = JobManager.deploySessionCluster(gatewayConfig); GatewayResult gatewayResult = JobManager.deploySessionCluster(gatewayConfig);
if (gatewayResult.isSuccess()) { if (gatewayResult.isSuccess()) {
Asserts.checkNullString(gatewayResult.getWebURL(), "Unable to obtain Web URL."); Asserts.checkNullString(gatewayResult.getWebURL(), "Unable to obtain Web URL.");
return registersCluster(ClusterInstanceDTO.autoRegistersClusterDTO( return registersCluster(ClusterInstanceDTO.builder()
gatewayResult.getWebURL().replace("http://", ""), .hosts(gatewayResult.getWebURL().replace("http://", ""))
gatewayResult.getId(), .name(gatewayResult.getId())
clusterCfg.getName() + "_" + LocalDateTime.now(), .alias(clusterCfg.getName() + "_" + LocalDateTime.now())
gatewayConfig.getType().getLongValue(), .type(gatewayConfig.getType().getLongValue())
id, .clusterConfigurationId(id)
null)); .autoRegisters(true)
.enabled(true)
.build());
} }
throw new DinkyException("Deploy session cluster error: " + gatewayResult.getError()); throw new DinkyException("Deploy session cluster error: " + gatewayResult.getError());
} }
......
...@@ -39,7 +39,7 @@ export type OperatorType = { ...@@ -39,7 +39,7 @@ export type OperatorType = {
}; };
const JobOperator = (props: OperatorType) => { const JobOperator = (props: OperatorType) => {
const { jobDetail, refesh } = props; const { jobDetail, refesh } = props;
const webUri = `/api/flink/${jobDetail?.history?.jobManagerAddress}/#/job/running/${jobDetail?.instance?.jid}/overview`; const webUri = `/api/flink/${jobDetail?.clusterInstance?.jobManagerHost}/#/job/running/${jobDetail?.instance?.jid}/overview`;
const handleJobOperator = (key: string) => { const handleJobOperator = (key: string) => {
Modal.confirm({ Modal.confirm({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment