|
@@ -6,6 +6,7 @@ import (
|
|
|
"cicv-data-closedloop/amd64/dispatch_server/package/infra"
|
|
|
"cicv-data-closedloop/amd64/dispatch_server/package/service"
|
|
|
"cicv-data-closedloop/amd64/dispatch_server/package/util"
|
|
|
+ "cicv-data-closedloop/common/entity"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
|
)
|
|
@@ -23,6 +24,11 @@ func State(c *gin.Context) {
|
|
|
taskId := c.Query("taskId")
|
|
|
state := c.Query("state")
|
|
|
podName := c.Query("podName") // todo 根据pod名称杀死pod并清理redis缓存
|
|
|
+ if taskId == "" || state == "" || podName == "" {
|
|
|
+ infra.GlobalLogger.Error("任务状态接口请求参数错误,需要GET请求和【taskId】【state】【podName】三个参数。")
|
|
|
+ c.JSON(http.StatusBadRequest, entity.HttpResult{Status: false, Code: "1003", Message: "请求参数格式错误。"})
|
|
|
+ return
|
|
|
+ }
|
|
|
if state != "Running" {
|
|
|
err := util.DeletePod(infra.ClientSet, podName, infra.ApplicationYaml.K8s.NamespaceName)
|
|
|
if err != nil {
|