|
@@ -50,6 +50,7 @@ public class ProjectManager {
|
|
int kafkaPartition,
|
|
int kafkaPartition,
|
|
long kafkaOffset,
|
|
long kafkaOffset,
|
|
String isChoiceGpu,
|
|
String isChoiceGpu,
|
|
|
|
+ int currentCount,
|
|
int cpuOrder
|
|
int cpuOrder
|
|
|
|
|
|
) {
|
|
) {
|
|
@@ -74,18 +75,24 @@ public class ProjectManager {
|
|
String replace12 = replace11.replace("namespace-name", kubernetesConfiguration.getNamespace()); // pod 名称包括 projectId 和 随机字符串
|
|
String replace12 = replace11.replace("namespace-name", kubernetesConfiguration.getNamespace()); // pod 名称包括 projectId 和 随机字符串
|
|
String replace13 = replace12.replace("node-name", nodeName); // 指定 pod 运行节点
|
|
String replace13 = replace12.replace("node-name", nodeName); // 指定 pod 运行节点
|
|
|
|
|
|
- String replace14 = replace13.replace("cpu-order", "\"" + cpuOrder + "\""); // 指定 cpu 编号
|
|
|
|
|
|
+ String replace14;
|
|
|
|
+ if (currentCount == 0) {
|
|
|
|
+ replace14 = replace13.replace("cpu-order", "\"" + cpuOrder + "\""); // 指定 cpu 编号
|
|
|
|
+ } else {
|
|
|
|
+ replace14 = replace13;
|
|
|
|
+ }
|
|
|
|
|
|
- String finalYaml = null;
|
|
|
|
|
|
+ String finalYaml;
|
|
if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
|
|
if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
|
|
log.info("项目 " + projectId + " 使用 gpu 生成视频");
|
|
log.info("项目 " + projectId + " 使用 gpu 生成视频");
|
|
String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdGpu());
|
|
String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdGpu());
|
|
finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdGpu());
|
|
finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdGpu());
|
|
- }
|
|
|
|
- if (DictConstants.NOT_USE_GPU.equals(isChoiceGpu)) {
|
|
|
|
|
|
+ } else if (DictConstants.NOT_USE_GPU.equals(isChoiceGpu)) {
|
|
log.info("项目 " + projectId + " 不使用 gpu 生成视频");
|
|
log.info("项目 " + projectId + " 不使用 gpu 生成视频");
|
|
String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdNogpu());
|
|
String replace15 = replace14.replace("vtd-image", kubernetesConfiguration.getImageVtdNogpu());
|
|
finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdNogpu());
|
|
finalYaml = replace15.replace("vtd-command", kubernetesConfiguration.getCommandVtdNogpu());
|
|
|
|
+ } else {
|
|
|
|
+ throw new RuntimeException("createTempYaml() 是否使用 gpu:" + isChoiceGpu);
|
|
}
|
|
}
|
|
log.info("保存项目 " + projectId + " 的 yaml 文件:" + podYamlDirectory + podYaml);
|
|
log.info("保存项目 " + projectId + " 的 yaml 文件:" + podYamlDirectory + podYaml);
|
|
FileUtil.writeStringToLocalFile(finalYaml, podYamlDirectory + podYaml);
|
|
FileUtil.writeStringToLocalFile(finalYaml, podYamlDirectory + podYaml);
|
|
@@ -115,7 +122,12 @@ public class ProjectManager {
|
|
String replace17 = replace16.replace("namespace-name", kubernetesConfiguration.getNamespace()); // pod 名称包括 projectId 和 随机字符串
|
|
String replace17 = replace16.replace("namespace-name", kubernetesConfiguration.getNamespace()); // pod 名称包括 projectId 和 随机字符串
|
|
String replace18 = replace17.replace("node-name", nodeName); // 指定 pod 运行节点
|
|
String replace18 = replace17.replace("node-name", nodeName); // 指定 pod 运行节点
|
|
|
|
|
|
- String replace19 = replace18.replace("cpu-order", "\"" + cpuOrder + "\""); // 指定 cpu 编号
|
|
|
|
|
|
+ String replace19;
|
|
|
|
+ if (currentCount == 0) {
|
|
|
|
+ replace19 = replace18.replace("cpu-order", "\"" + cpuOrder + "\""); // 指定 cpu 编号
|
|
|
|
+ } else {
|
|
|
|
+ replace19 = replace18;
|
|
|
|
+ }
|
|
|
|
|
|
String finalYaml;
|
|
String finalYaml;
|
|
if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
|
|
if (DictConstants.USE_GPU.equals(isChoiceGpu)) {
|