서버상태수정
This commit is contained in:
@@ -46,6 +46,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -81,9 +82,14 @@ public class InferenceResultService {
|
|||||||
@Value("${inference.batch-url}")
|
@Value("${inference.batch-url}")
|
||||||
private String batchUrl;
|
private String batchUrl;
|
||||||
|
|
||||||
|
@Value("${inference.inference-server-name}")
|
||||||
|
private String inferenceServerName;
|
||||||
|
|
||||||
@Value("${file.dataset-dir}")
|
@Value("${file.dataset-dir}")
|
||||||
private String datasetDir;
|
private String datasetDir;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
@@ -516,44 +522,46 @@ public class InferenceResultService {
|
|||||||
|
|
||||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||||
|
|
||||||
|
String[] serverNames = inferenceServerName.split(",");
|
||||||
|
int serveCnt = serverNames.length;
|
||||||
|
|
||||||
List<InferenceServerStatusDto> dtoList =
|
List<InferenceServerStatusDto> dtoList =
|
||||||
inferenceResultCoreService.getInferenceServerStatusList();
|
inferenceResultCoreService.getInferenceServerStatusList();
|
||||||
int size = dtoList.size();
|
int size = dtoList.size();
|
||||||
|
|
||||||
|
List<InferenceServerStatusDto> serverStatusList = new ArrayList<>();
|
||||||
|
|
||||||
System.out.println("size =" + size);
|
System.out.println("size =" + size);
|
||||||
|
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
for (int k = 1; k <= 4; k++) {
|
for (int k = 0; k < serveCnt; k++) {
|
||||||
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
||||||
dto.setServerName("server" + k);
|
dto.setServerName(serverNames[k]);
|
||||||
dto.setCpu_user(0);
|
dto.setCpu_user(0);
|
||||||
dto.setCpu_system(0);
|
dto.setCpu_system(0);
|
||||||
dto.setMemused(0);
|
dto.setMemused(0);
|
||||||
dto.setKbmemused(0L);
|
dto.setKbmemused(0L);
|
||||||
dto.setGpuUtil(0);
|
dto.setGpuUtil(0);
|
||||||
|
|
||||||
dtoList.add(dto);
|
serverStatusList.add(dto);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (int k = 1; k <= 4; k++) {
|
for (int k = 0; k < serveCnt; k++) {
|
||||||
String srvNm = "server" + k;
|
String srvNm = serverNames[k];
|
||||||
String srvNmChk = "N";
|
String srvNmChk = "N";
|
||||||
|
|
||||||
int serverCnt =
|
Optional<InferenceServerStatusDto> matchingDto = dtoList.stream()
|
||||||
(int)
|
.filter(dto -> srvNm.equals(dto.getServerName()))
|
||||||
dtoList.stream().filter(dto -> dto.getServerName().toString().equals(srvNm)).count();
|
.findFirst();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (InferenceServerStatusDto dto : dtoList) {
|
int serverChekcCnt =
|
||||||
if (srvNm.equals(dto.getServerName())) {
|
(int)
|
||||||
srvNmChk = "Y";
|
dtoList.stream().filter(dto -> dto.getServerName().toString().equals(srvNm)).count();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (serverCnt == 0) {
|
if (matchingDto.isEmpty()) {
|
||||||
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
InferenceServerStatusDto dto = new InferenceServerStatusDto();
|
||||||
dto.setServerName(srvNm);
|
dto.setServerName(srvNm);
|
||||||
dto.setCpu_user(0);
|
dto.setCpu_user(0);
|
||||||
@@ -561,16 +569,20 @@ public class InferenceResultService {
|
|||||||
dto.setMemused(0);
|
dto.setMemused(0);
|
||||||
dto.setKbmemused(0L);
|
dto.setKbmemused(0L);
|
||||||
dto.setGpuUtil(0);
|
dto.setGpuUtil(0);
|
||||||
dtoList.add(dto);
|
serverStatusList.add(dto);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serverStatusList.add(matchingDto.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dtoList.sort(Comparator.comparing(InferenceServerStatusDto::getServerName));
|
serverStatusList.sort(Comparator.comparing(InferenceServerStatusDto::getServerName));
|
||||||
|
|
||||||
return dtoList;
|
return serverStatusList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -153,8 +153,6 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
systemMetricEntity.memused,
|
systemMetricEntity.memused,
|
||||||
systemMetricEntity.kbmemused,
|
systemMetricEntity.kbmemused,
|
||||||
gpuMetricEntity.gpuUtil
|
gpuMetricEntity.gpuUtil
|
||||||
// gpuMetricEntity.gpuMemUsed,
|
|
||||||
// gpuMetricEntity.gpuMemTotal
|
|
||||||
))
|
))
|
||||||
.from(systemMetricEntity)
|
.from(systemMetricEntity)
|
||||||
.leftJoin(gpuMetricEntity)
|
.leftJoin(gpuMetricEntity)
|
||||||
@@ -163,7 +161,9 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.timestamp
|
.timestamp
|
||||||
.in(latestGpuIds)
|
.in(latestGpuIds)
|
||||||
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
||||||
.where(systemMetricEntity.timestamp.in(latestIds)) // In 절 사용
|
.where(systemMetricEntity.timestamp.in(latestIds)
|
||||||
|
//.and(systemMetricEntity.serverName.ne("server2"))
|
||||||
|
) // In 절 사용
|
||||||
.orderBy(systemMetricEntity.serverName.asc())
|
.orderBy(systemMetricEntity.serverName.asc())
|
||||||
.limit(4)
|
.limit(4)
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ file:
|
|||||||
sync-root-dir: /kamco-nfs/images/
|
sync-root-dir: /kamco-nfs/images/
|
||||||
sync-tmp-dir: ${file.sync-root-dir}/tmp
|
sync-tmp-dir: ${file.sync-root-dir}/tmp
|
||||||
sync-file-extention: tfw,tif
|
sync-file-extention: tfw,tif
|
||||||
sync-auto-exception-start-year: 2025
|
sync-auto-exception-start-year: 2024
|
||||||
sync-auto-exception-before-year-cnt: 3
|
sync-auto-exception-before-year-cnt: 3
|
||||||
|
|
||||||
#dataset-dir: D:/kamco-nfs/dataset/
|
#dataset-dir: D:/kamco-nfs/dataset/
|
||||||
@@ -109,6 +109,7 @@ inference:
|
|||||||
batch-url: http://10.100.0.11:8000/batches
|
batch-url: http://10.100.0.11:8000/batches
|
||||||
geojson-dir: /kamco-nfs/requests/
|
geojson-dir: /kamco-nfs/requests/
|
||||||
jar-path: /kamco-nfs/dataset/shp_exporter-1.0.0.jar
|
jar-path: /kamco-nfs/dataset/shp_exporter-1.0.0.jar
|
||||||
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
#url: http://localhost:8080
|
#url: http://localhost:8080
|
||||||
|
|||||||
Reference in New Issue
Block a user