|
@@ -49,7 +49,7 @@ public class ServerScheduler {
|
|
|
public void server() {
|
|
|
try {
|
|
|
List<SystemServerPO> systemServerPOList = new ArrayList<>();
|
|
|
- log.info("服务器列表为:" + hostList);
|
|
|
+ log.info("服务器列表为:{}", hostList);
|
|
|
for (Host host : hostList) {
|
|
|
int taskNumber = 0;
|
|
|
SshClient sshClient = SshClient.setUpDefaultClient();
|
|
@@ -61,7 +61,12 @@ public class ServerScheduler {
|
|
|
double gpuUsage = 0.0;
|
|
|
long gpuTotal = 0L;
|
|
|
if ("gpu".equals(type)) {
|
|
|
- gpuUsage = SshUtil.gpuUsage(session);
|
|
|
+ try {
|
|
|
+ gpuUsage = SshUtil.gpuUsage(session);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("服务器 {} 可能没有安装显卡驱动,报异常:{}", host, e.getMessage());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
gpuTotal = SshUtil.gpuTotal(session);
|
|
|
String podList = SshUtil.execute(session, "kubectl get pod | grep project");
|
|
|
taskNumber = StringUtil.countSubString(podList, "project");
|
|
@@ -94,7 +99,7 @@ public class ServerScheduler {
|
|
|
session.close();
|
|
|
sshClient.stop();
|
|
|
}
|
|
|
- log.info("获取服务器信息。" + systemServerPOList);
|
|
|
+ log.info("获取服务器信息。{}", systemServerPOList);
|
|
|
systemServerDomainService.deleteAndInsert(systemServerPOList);
|
|
|
} catch (IOException | DocumentException | InterruptedException e) {
|
|
|
throw new RuntimeException(e);
|
|
@@ -117,7 +122,7 @@ public class ServerScheduler {
|
|
|
});
|
|
|
//3 查询不在id列表中的所有泛化数据
|
|
|
List<GeneralEntity> generalEntities = scenePackageSublistMapper.selectGeneralDataNotIn(sceneGeneralizationIdList);
|
|
|
- log.info("准备删除:" + generalEntities);
|
|
|
+ log.info("准备删除:{}", generalEntities);
|
|
|
generalEntities.forEach(
|
|
|
generalEntity -> {
|
|
|
if (StringUtil.isNotEmpty(generalEntity.getOsgbAddress())) {
|
|
@@ -133,7 +138,7 @@ public class ServerScheduler {
|
|
|
}
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
|