| @@ -6,9 +6,9 @@ Port: 8999 | |||||
| KqProducerConf: | KqProducerConf: | ||||
| Brokers: | Brokers: | ||||
| - 10.101.15.174:31895 | - 10.101.15.174:31895 | ||||
| HpcTopic: Schedule-Hpc-Topic | |||||
| CloudTopic: Schedule-Cloud-Topic | |||||
| AiTopic: Schedule-Ai-Topic | |||||
| HpcTopic: Schedule-Hpc-Topic-ZW | |||||
| CloudTopic: Schedule-Cloud-Topic-ZW | |||||
| AiTopic: Schedule-Ai-Topic-ZW | |||||
| DB: | DB: | ||||
| DataSource: root:uJpLd6u-J?HC1@(106.53.150.192:3306)/pcm?parseTime=true | DataSource: root:uJpLd6u-J?HC1@(106.53.150.192:3306)/pcm?parseTime=true | ||||
| @@ -27,7 +27,7 @@ HpcConsumerConf: | |||||
| Brokers: | Brokers: | ||||
| - 10.101.15.174:31895 | - 10.101.15.174:31895 | ||||
| Group: Schedule-Hpc-group | Group: Schedule-Hpc-group | ||||
| Topic: Schedule-Hpc-Topic | |||||
| Topic: Schedule-Hpc-Topic-ZW | |||||
| Offset: first | Offset: first | ||||
| Consumers: 1 | Consumers: 1 | ||||
| Processors: 1 | Processors: 1 | ||||
| @@ -37,7 +37,7 @@ AiConsumerConf: | |||||
| Brokers: | Brokers: | ||||
| - 10.101.15.174:31895 | - 10.101.15.174:31895 | ||||
| Group: Schedule-Ai-group | Group: Schedule-Ai-group | ||||
| Topic: Schedule-Ai-Topic | |||||
| Topic: Schedule-Ai-Topic-ZW | |||||
| Offset: first | Offset: first | ||||
| Consumers: 1 | Consumers: 1 | ||||
| Processors: 1 | Processors: 1 | ||||
| @@ -47,7 +47,7 @@ CloudConsumerConf: | |||||
| Brokers: | Brokers: | ||||
| - 10.101.15.174:31895 | - 10.101.15.174:31895 | ||||
| Group: Schedule-Cloud-group | Group: Schedule-Cloud-group | ||||
| Topic: Schedule-Cloud-Topic | |||||
| Topic: Schedule-Cloud-Topic-ZW | |||||
| Offset: first | Offset: first | ||||
| Consumers: 1 | Consumers: 1 | ||||
| Processors: 1 | Processors: 1 | ||||
| @@ -60,6 +60,7 @@ K8sNativeConf: | |||||
| Key: kubenative.rpc | Key: kubenative.rpc | ||||
| User: root | User: root | ||||
| Pass: I9wLvrRufj | Pass: I9wLvrRufj | ||||
| NonBlock: true | |||||
| #rpc | #rpc | ||||
| THRpcConf: | THRpcConf: | ||||
| @@ -69,6 +70,7 @@ THRpcConf: | |||||
| Key: hpcth.rpc | Key: hpcth.rpc | ||||
| User: root | User: root | ||||
| Pass: I9wLvrRufj | Pass: I9wLvrRufj | ||||
| NonBlock: true | |||||
| #rpc | #rpc | ||||
| ModelArtsRpcConf: | ModelArtsRpcConf: | ||||
| @@ -78,6 +80,7 @@ ModelArtsRpcConf: | |||||
| Key: modelarts.rpc | Key: modelarts.rpc | ||||
| User: root | User: root | ||||
| Pass: I9wLvrRufj | Pass: I9wLvrRufj | ||||
| NonBlock: true | |||||
| #rpc | #rpc | ||||
| @@ -88,3 +91,4 @@ ACRpcConf: | |||||
| Key: hpcac.rpc | Key: hpcac.rpc | ||||
| User: root | User: root | ||||
| Pass: I9wLvrRufj | Pass: I9wLvrRufj | ||||
| NonBlock: true | |||||
| @@ -45,10 +45,8 @@ func (l *TaskListLogic) TaskList() (resp *types.TaskListResp, err error) { | |||||
| } | } | ||||
| for _, task := range tasks { | for _, task := range tasks { | ||||
| resp.Data.TotalRunTime = int(task.RunningTime) + resp.Data.TotalRunTime | resp.Data.TotalRunTime = int(task.RunningTime) + resp.Data.TotalRunTime | ||||
| // 运行卡时数 | |||||
| if task.Kind == "hpc" && task.CardCount != 0 { | |||||
| cardTime = int(task.RunningTime*task.CardCount) + cardTime | |||||
| } | |||||
| // 运行卡时数 todo | |||||
| currentStatus, _ := l.svcCtx.RedisClient.Get(l.ctx, task.Status).Result() | currentStatus, _ := l.svcCtx.RedisClient.Get(l.ctx, task.Status).Result() | ||||
| if currentStatus == "" { | if currentStatus == "" { | ||||
| currentStatus = task.Status | currentStatus = task.Status | ||||
| @@ -3,10 +3,11 @@ package kq | |||||
| import ( | import ( | ||||
| "PCM/adaptor/PCM-CORE/api/internal/svc" | "PCM/adaptor/PCM-CORE/api/internal/svc" | ||||
| "PCM/adaptor/PCM-CORE/api/internal/types" | "PCM/adaptor/PCM-CORE/api/internal/types" | ||||
| "PCM/adaptor/PCM-CORE/model" | |||||
| "PCM/common/param" | |||||
| "PCM/common/tool" | "PCM/common/tool" | ||||
| "context" | "context" | ||||
| "encoding/json" | "encoding/json" | ||||
| "sigs.k8s.io/yaml" | |||||
| ) | ) | ||||
| /* | /* | ||||
| @@ -29,10 +30,24 @@ func (l *ScheduleHpcMq) Consume(_, val string) error { | |||||
| // 接受消息 | // 接受消息 | ||||
| var req *types.ScheduleTaskReq | var req *types.ScheduleTaskReq | ||||
| json.Unmarshal([]byte(val), &req) | json.Unmarshal([]byte(val), &req) | ||||
| var hpc model.Hpc | |||||
| tool.Convert(req.Metadata, &hpc) | |||||
| var hpcBaseList []param.HpcBase | |||||
| tool.Convert(req.Metadata, &hpcBaseList) | |||||
| for index, _ := range hpcBaseList { | |||||
| hpcBaseList[index].TaskId = req.TaskId | |||||
| hpcBaseList[index].Status = "Saved" | |||||
| // 解析超算信息以yaml形式存储到数据库中 | |||||
| jsonBytes, err := json.Marshal(hpcBaseList[index]) | |||||
| if err != nil { | |||||
| return err | |||||
| } | |||||
| bytes, err := yaml.JSONToYAML(jsonBytes) | |||||
| if err != nil { | |||||
| return err | |||||
| } | |||||
| hpcBaseList[index].YamlString = string(bytes) | |||||
| } | |||||
| // 存储数据 | // 存储数据 | ||||
| _, err := l.svcCtx.Db.NamedExec("insert into cloud (task_id,service_name,name,status) values (:task_id,:service_name,:name,:status)", hpc) | |||||
| _, err := l.svcCtx.Db.NamedExec("insert into hpc (task_id,service_name,name,work_dir,wall_time,status) values (:task_id,:service_name,:name,:work_dir,:wall_time,:status)", hpcBaseList) | |||||
| if err != nil { | if err != nil { | ||||
| return err | return err | ||||
| } | } | ||||
| @@ -22,6 +22,6 @@ type ( | |||||
| // NewAiModel returns a model for the database table. | // NewAiModel returns a model for the database table. | ||||
| func NewAiModel(conn sqlx.SqlConn, c cache.CacheConf) AiModel { | func NewAiModel(conn sqlx.SqlConn, c cache.CacheConf) AiModel { | ||||
| return &customAiModel{ | return &customAiModel{ | ||||
| defaultAiModel: newAiModel(conn, c), | |||||
| defaultAiModel: newAiModel(conn), | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,7 +9,6 @@ import ( | |||||
| "strings" | "strings" | ||||
| "github.com/zeromicro/go-zero/core/stores/builder" | "github.com/zeromicro/go-zero/core/stores/builder" | ||||
| "github.com/zeromicro/go-zero/core/stores/cache" | |||||
| "github.com/zeromicro/go-zero/core/stores/sqlc" | "github.com/zeromicro/go-zero/core/stores/sqlc" | ||||
| "github.com/zeromicro/go-zero/core/stores/sqlx" | "github.com/zeromicro/go-zero/core/stores/sqlx" | ||||
| "github.com/zeromicro/go-zero/core/stringx" | "github.com/zeromicro/go-zero/core/stringx" | ||||
| @@ -20,28 +19,27 @@ var ( | |||||
| aiRows = strings.Join(aiFieldNames, ",") | aiRows = strings.Join(aiFieldNames, ",") | ||||
| aiRowsExpectAutoSet = strings.Join(stringx.Remove(aiFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | aiRowsExpectAutoSet = strings.Join(stringx.Remove(aiFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | ||||
| aiRowsWithPlaceHolder = strings.Join(stringx.Remove(aiFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | aiRowsWithPlaceHolder = strings.Join(stringx.Remove(aiFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | ||||
| cachePcmAiIdPrefix = "cache:pcm:ai:id:" | |||||
| ) | ) | ||||
| type ( | type ( | ||||
| aiModel interface { | aiModel interface { | ||||
| Insert(ctx context.Context, data *Ai) (sql.Result, error) | Insert(ctx context.Context, data *Ai) (sql.Result, error) | ||||
| FindOne(ctx context.Context, id int64) (*Ai, error) | FindOne(ctx context.Context, id int64) (*Ai, error) | ||||
| FindOneByServiceNameProjectIdName(ctx context.Context, serviceName sql.NullString, projectId sql.NullString, name sql.NullString) (*Ai, error) | |||||
| Update(ctx context.Context, data *Ai) error | Update(ctx context.Context, data *Ai) error | ||||
| Delete(ctx context.Context, id int64) error | Delete(ctx context.Context, id int64) error | ||||
| } | } | ||||
| defaultAiModel struct { | defaultAiModel struct { | ||||
| sqlc.CachedConn | |||||
| conn sqlx.SqlConn | |||||
| table string | table string | ||||
| } | } | ||||
| Ai struct { | Ai struct { | ||||
| Id int64 `db:"id"` // id | Id int64 `db:"id"` // id | ||||
| TaskId sql.NullInt64 `db:"task_id"` // 任务id | TaskId sql.NullInt64 `db:"task_id"` // 任务id | ||||
| ProjectId string `db:"project_id"` // 项目id | |||||
| Name string `db:"name"` // 名称 | |||||
| ProjectId sql.NullString `db:"project_id"` // 项目id | |||||
| Name sql.NullString `db:"name"` // 名称 | |||||
| Status sql.NullString `db:"status"` // 状态 | Status sql.NullString `db:"status"` // 状态 | ||||
| StartTime sql.NullTime `db:"start_time"` // 开始时间 | StartTime sql.NullTime `db:"start_time"` // 开始时间 | ||||
| RunningTime sql.NullInt64 `db:"running_time"` // 运行时间 | RunningTime sql.NullInt64 `db:"running_time"` // 运行时间 | ||||
| @@ -50,32 +48,43 @@ type ( | |||||
| UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人 | UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人 | ||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | ||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | ||||
| ServiceName sql.NullString `db:"service_name"` | |||||
| Result sql.NullString `db:"result"` | |||||
| YamlString sql.NullInt64 `db:"yaml_string"` | |||||
| } | } | ||||
| ) | ) | ||||
| func newAiModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultAiModel { | |||||
| func newAiModel(conn sqlx.SqlConn) *defaultAiModel { | |||||
| return &defaultAiModel{ | return &defaultAiModel{ | ||||
| CachedConn: sqlc.NewConn(conn, c), | |||||
| table: "`ai`", | |||||
| conn: conn, | |||||
| table: "`ai`", | |||||
| } | } | ||||
| } | } | ||||
| func (m *defaultAiModel) Delete(ctx context.Context, id int64) error { | func (m *defaultAiModel) Delete(ctx context.Context, id int64) error { | ||||
| pcmAiIdKey := fmt.Sprintf("%s%v", cachePcmAiIdPrefix, id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| return conn.ExecCtx(ctx, query, id) | |||||
| }, pcmAiIdKey) | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| _, err := m.conn.ExecCtx(ctx, query, id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultAiModel) FindOne(ctx context.Context, id int64) (*Ai, error) { | func (m *defaultAiModel) FindOne(ctx context.Context, id int64) (*Ai, error) { | ||||
| pcmAiIdKey := fmt.Sprintf("%s%v", cachePcmAiIdPrefix, id) | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", aiRows, m.table) | |||||
| var resp Ai | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, id) | |||||
| switch err { | |||||
| case nil: | |||||
| return &resp, nil | |||||
| case sqlc.ErrNotFound: | |||||
| return nil, ErrNotFound | |||||
| default: | |||||
| return nil, err | |||||
| } | |||||
| } | |||||
| func (m *defaultAiModel) FindOneByServiceNameProjectIdName(ctx context.Context, serviceName sql.NullString, projectId sql.NullString, name sql.NullString) (*Ai, error) { | |||||
| var resp Ai | var resp Ai | ||||
| err := m.QueryRowCtx(ctx, &resp, pcmAiIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", aiRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, id) | |||||
| }) | |||||
| query := fmt.Sprintf("select %s from %s where `service_name` = ? and `project_id` = ? and `name` = ? limit 1", aiRows, m.table) | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, serviceName, projectId, name) | |||||
| switch err { | switch err { | ||||
| case nil: | case nil: | ||||
| return &resp, nil | return &resp, nil | ||||
| @@ -87,32 +96,17 @@ func (m *defaultAiModel) FindOne(ctx context.Context, id int64) (*Ai, error) { | |||||
| } | } | ||||
| func (m *defaultAiModel) Insert(ctx context.Context, data *Ai) (sql.Result, error) { | func (m *defaultAiModel) Insert(ctx context.Context, data *Ai) (sql.Result, error) { | ||||
| pcmAiIdKey := fmt.Sprintf("%s%v", cachePcmAiIdPrefix, data.Id) | |||||
| ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, aiRowsExpectAutoSet) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.ProjectId, data.Name, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag) | |||||
| }, pcmAiIdKey) | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, aiRowsExpectAutoSet) | |||||
| ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.ProjectId, data.Name, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.ServiceName, data.Result, data.YamlString) | |||||
| return ret, err | return ret, err | ||||
| } | } | ||||
| func (m *defaultAiModel) Update(ctx context.Context, data *Ai) error { | |||||
| pcmAiIdKey := fmt.Sprintf("%s%v", cachePcmAiIdPrefix, data.Id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, aiRowsWithPlaceHolder) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.ProjectId, data.Name, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id) | |||||
| }, pcmAiIdKey) | |||||
| func (m *defaultAiModel) Update(ctx context.Context, newData *Ai) error { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, aiRowsWithPlaceHolder) | |||||
| _, err := m.conn.ExecCtx(ctx, query, newData.TaskId, newData.ProjectId, newData.Name, newData.Status, newData.StartTime, newData.RunningTime, newData.CreatedBy, newData.CreatedTime, newData.UpdatedBy, newData.UpdatedTime, newData.DeletedFlag, newData.ServiceName, newData.Result, newData.YamlString, newData.Id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultAiModel) formatPrimary(primary interface{}) string { | |||||
| return fmt.Sprintf("%s%v", cachePcmAiIdPrefix, primary) | |||||
| } | |||||
| func (m *defaultAiModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", aiRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, primary) | |||||
| } | |||||
| func (m *defaultAiModel) tableName() string { | func (m *defaultAiModel) tableName() string { | ||||
| return m.table | return m.table | ||||
| } | } | ||||
| @@ -22,6 +22,6 @@ type ( | |||||
| // NewCloudModel returns a model for the database table. | // NewCloudModel returns a model for the database table. | ||||
| func NewCloudModel(conn sqlx.SqlConn, c cache.CacheConf) CloudModel { | func NewCloudModel(conn sqlx.SqlConn, c cache.CacheConf) CloudModel { | ||||
| return &customCloudModel{ | return &customCloudModel{ | ||||
| defaultCloudModel: newCloudModel(conn, c), | |||||
| defaultCloudModel: newCloudModel(conn), | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ import ( | |||||
| "time" | "time" | ||||
| "github.com/zeromicro/go-zero/core/stores/builder" | "github.com/zeromicro/go-zero/core/stores/builder" | ||||
| "github.com/zeromicro/go-zero/core/stores/cache" | |||||
| "github.com/zeromicro/go-zero/core/stores/sqlc" | "github.com/zeromicro/go-zero/core/stores/sqlc" | ||||
| "github.com/zeromicro/go-zero/core/stores/sqlx" | "github.com/zeromicro/go-zero/core/stores/sqlx" | ||||
| "github.com/zeromicro/go-zero/core/stringx" | "github.com/zeromicro/go-zero/core/stringx" | ||||
| @@ -21,64 +20,74 @@ var ( | |||||
| cloudRows = strings.Join(cloudFieldNames, ",") | cloudRows = strings.Join(cloudFieldNames, ",") | ||||
| cloudRowsExpectAutoSet = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | cloudRowsExpectAutoSet = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | ||||
| cloudRowsWithPlaceHolder = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | cloudRowsWithPlaceHolder = strings.Join(stringx.Remove(cloudFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | ||||
| cachePcmCloudIdPrefix = "cache:pcm:cloud:id:" | |||||
| ) | ) | ||||
| type ( | type ( | ||||
| cloudModel interface { | cloudModel interface { | ||||
| Insert(ctx context.Context, data *Cloud) (sql.Result, error) | Insert(ctx context.Context, data *Cloud) (sql.Result, error) | ||||
| FindOne(ctx context.Context, id int64) (*Cloud, error) | FindOne(ctx context.Context, id int64) (*Cloud, error) | ||||
| FindOneByNamespaceNameServiceName(ctx context.Context, namespace sql.NullString, name sql.NullString, serviceName sql.NullString) (*Cloud, error) | |||||
| Update(ctx context.Context, data *Cloud) error | Update(ctx context.Context, data *Cloud) error | ||||
| Delete(ctx context.Context, id int64) error | Delete(ctx context.Context, id int64) error | ||||
| } | } | ||||
| defaultCloudModel struct { | defaultCloudModel struct { | ||||
| sqlc.CachedConn | |||||
| conn sqlx.SqlConn | |||||
| table string | table string | ||||
| } | } | ||||
| Cloud struct { | Cloud struct { | ||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ApiVersion string `db:"api_version"` | |||||
| Name string `db:"name"` // 名称 | |||||
| Namespace string `db:"namespace"` // 命名空间 | |||||
| Kind string `db:"kind"` // 种类 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime time.Time `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时长 | |||||
| CreatedBy sql.NullInt64 `db:"created_by"` // 创建人 | |||||
| CreatedTime time.Time `db:"created_time"` // 创建时间 | |||||
| UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime time.Time `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| Id int64 `db:"id"` // id | |||||
| TaskId int64 `db:"task_id"` // 任务id | |||||
| ApiVersion string `db:"api_version"` | |||||
| Name string `db:"name"` // 名称 | |||||
| Namespace string `db:"namespace"` // 命名空间 | |||||
| Kind string `db:"kind"` // 种类 | |||||
| Status string `db:"status"` // 状态 | |||||
| StartTime time.Time `db:"start_time"` // 开始时间 | |||||
| RunningTime int64 `db:"running_time"` // 运行时长 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| CreatedTime time.Time `db:"created_time"` // 创建时间 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| UpdatedTime time.Time `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| ServiceName string `db:"service_name"` | |||||
| YamlString string `db:"yaml_string"` | |||||
| Result string `db:"result"` | |||||
| } | } | ||||
| ) | ) | ||||
| func newCloudModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultCloudModel { | |||||
| func newCloudModel(conn sqlx.SqlConn) *defaultCloudModel { | |||||
| return &defaultCloudModel{ | return &defaultCloudModel{ | ||||
| CachedConn: sqlc.NewConn(conn, c), | |||||
| table: "`cloud`", | |||||
| conn: conn, | |||||
| table: "`cloud`", | |||||
| } | } | ||||
| } | } | ||||
| func (m *defaultCloudModel) Delete(ctx context.Context, id int64) error { | func (m *defaultCloudModel) Delete(ctx context.Context, id int64) error { | ||||
| pcmCloudIdKey := fmt.Sprintf("%s%v", cachePcmCloudIdPrefix, id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| return conn.ExecCtx(ctx, query, id) | |||||
| }, pcmCloudIdKey) | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| _, err := m.conn.ExecCtx(ctx, query, id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultCloudModel) FindOne(ctx context.Context, id int64) (*Cloud, error) { | func (m *defaultCloudModel) FindOne(ctx context.Context, id int64) (*Cloud, error) { | ||||
| pcmCloudIdKey := fmt.Sprintf("%s%v", cachePcmCloudIdPrefix, id) | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", cloudRows, m.table) | |||||
| var resp Cloud | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, id) | |||||
| switch err { | |||||
| case nil: | |||||
| return &resp, nil | |||||
| case sqlc.ErrNotFound: | |||||
| return nil, ErrNotFound | |||||
| default: | |||||
| return nil, err | |||||
| } | |||||
| } | |||||
| func (m *defaultCloudModel) FindOneByNamespaceNameServiceName(ctx context.Context, namespace sql.NullString, name sql.NullString, serviceName sql.NullString) (*Cloud, error) { | |||||
| var resp Cloud | var resp Cloud | ||||
| err := m.QueryRowCtx(ctx, &resp, pcmCloudIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", cloudRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, id) | |||||
| }) | |||||
| query := fmt.Sprintf("select %s from %s where `namespace` = ? and `name` = ? and `service_name` = ? limit 1", cloudRows, m.table) | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, namespace, name, serviceName) | |||||
| switch err { | switch err { | ||||
| case nil: | case nil: | ||||
| return &resp, nil | return &resp, nil | ||||
| @@ -90,32 +99,17 @@ func (m *defaultCloudModel) FindOne(ctx context.Context, id int64) (*Cloud, erro | |||||
| } | } | ||||
| func (m *defaultCloudModel) Insert(ctx context.Context, data *Cloud) (sql.Result, error) { | func (m *defaultCloudModel) Insert(ctx context.Context, data *Cloud) (sql.Result, error) { | ||||
| pcmCloudIdKey := fmt.Sprintf("%s%v", cachePcmCloudIdPrefix, data.Id) | |||||
| ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, cloudRowsExpectAutoSet) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.ApiVersion, data.Name, data.Namespace, data.Kind, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag) | |||||
| }, pcmCloudIdKey) | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, cloudRowsExpectAutoSet) | |||||
| ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.ApiVersion, data.Name, data.Namespace, data.Kind, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.ServiceName, data.YamlString, data.Result) | |||||
| return ret, err | return ret, err | ||||
| } | } | ||||
| func (m *defaultCloudModel) Update(ctx context.Context, data *Cloud) error { | |||||
| pcmCloudIdKey := fmt.Sprintf("%s%v", cachePcmCloudIdPrefix, data.Id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, cloudRowsWithPlaceHolder) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.ApiVersion, data.Name, data.Namespace, data.Kind, data.Status, data.StartTime, data.RunningTime, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id) | |||||
| }, pcmCloudIdKey) | |||||
| func (m *defaultCloudModel) Update(ctx context.Context, newData *Cloud) error { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, cloudRowsWithPlaceHolder) | |||||
| _, err := m.conn.ExecCtx(ctx, query, newData.TaskId, newData.ApiVersion, newData.Name, newData.Namespace, newData.Kind, newData.Status, newData.StartTime, newData.RunningTime, newData.CreatedBy, newData.CreatedTime, newData.UpdatedBy, newData.UpdatedTime, newData.DeletedFlag, newData.ServiceName, newData.YamlString, newData.Result, newData.Id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultCloudModel) formatPrimary(primary interface{}) string { | |||||
| return fmt.Sprintf("%s%v", cachePcmCloudIdPrefix, primary) | |||||
| } | |||||
| func (m *defaultCloudModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", cloudRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, primary) | |||||
| } | |||||
| func (m *defaultCloudModel) tableName() string { | func (m *defaultCloudModel) tableName() string { | ||||
| return m.table | return m.table | ||||
| } | } | ||||
| @@ -22,6 +22,6 @@ type ( | |||||
| // NewHpcModel returns a model for the database table. | // NewHpcModel returns a model for the database table. | ||||
| func NewHpcModel(conn sqlx.SqlConn, c cache.CacheConf) HpcModel { | func NewHpcModel(conn sqlx.SqlConn, c cache.CacheConf) HpcModel { | ||||
| return &customHpcModel{ | return &customHpcModel{ | ||||
| defaultHpcModel: newHpcModel(conn, c), | |||||
| defaultHpcModel: newHpcModel(conn), | |||||
| } | } | ||||
| } | } | ||||
| @@ -7,9 +7,9 @@ import ( | |||||
| "database/sql" | "database/sql" | ||||
| "fmt" | "fmt" | ||||
| "strings" | "strings" | ||||
| "time" | |||||
| "github.com/zeromicro/go-zero/core/stores/builder" | "github.com/zeromicro/go-zero/core/stores/builder" | ||||
| "github.com/zeromicro/go-zero/core/stores/cache" | |||||
| "github.com/zeromicro/go-zero/core/stores/sqlc" | "github.com/zeromicro/go-zero/core/stores/sqlc" | ||||
| "github.com/zeromicro/go-zero/core/stores/sqlx" | "github.com/zeromicro/go-zero/core/stores/sqlx" | ||||
| "github.com/zeromicro/go-zero/core/stringx" | "github.com/zeromicro/go-zero/core/stringx" | ||||
| @@ -20,20 +20,19 @@ var ( | |||||
| hpcRows = strings.Join(hpcFieldNames, ",") | hpcRows = strings.Join(hpcFieldNames, ",") | ||||
| hpcRowsExpectAutoSet = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | hpcRowsExpectAutoSet = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") | ||||
| hpcRowsWithPlaceHolder = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | hpcRowsWithPlaceHolder = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" | ||||
| cachePcmHpcIdPrefix = "cache:pcm:hpc:id:" | |||||
| ) | ) | ||||
| type ( | type ( | ||||
| hpcModel interface { | hpcModel interface { | ||||
| Insert(ctx context.Context, data *Hpc) (sql.Result, error) | Insert(ctx context.Context, data *Hpc) (sql.Result, error) | ||||
| FindOne(ctx context.Context, id int64) (*Hpc, error) | FindOne(ctx context.Context, id int64) (*Hpc, error) | ||||
| FindOneByServiceNameName(ctx context.Context, serviceName sql.NullString, name sql.NullString) (*Hpc, error) | |||||
| Update(ctx context.Context, data *Hpc) error | Update(ctx context.Context, data *Hpc) error | ||||
| Delete(ctx context.Context, id int64) error | Delete(ctx context.Context, id int64) error | ||||
| } | } | ||||
| defaultHpcModel struct { | defaultHpcModel struct { | ||||
| sqlc.CachedConn | |||||
| conn sqlx.SqlConn | |||||
| table string | table string | ||||
| } | } | ||||
| @@ -48,36 +47,48 @@ type ( | |||||
| RunningTime sql.NullInt64 `db:"running_time"` // 运行时间 | RunningTime sql.NullInt64 `db:"running_time"` // 运行时间 | ||||
| CardCount sql.NullInt64 `db:"card_count"` // 卡数 | CardCount sql.NullInt64 `db:"card_count"` // 卡数 | ||||
| CreatedBy sql.NullInt64 `db:"created_by"` // 创建人 | CreatedBy sql.NullInt64 `db:"created_by"` // 创建人 | ||||
| CreatedTime sql.NullTime `db:"created_time"` // 创建时间 | |||||
| CreatedTime time.Time `db:"created_time"` // 创建时间 | |||||
| UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人 | UpdatedBy sql.NullInt64 `db:"updated_by"` // 更新人 | ||||
| UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间 | |||||
| UpdatedTime time.Time `db:"updated_time"` // 更新时间 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | ||||
| WorkDir sql.NullString `db:"work_dir"` | |||||
| WallTime sql.NullString `db:"wall_time"` | |||||
| Result sql.NullString `db:"result"` | |||||
| YamlString sql.NullString `db:"yaml_string"` | |||||
| } | } | ||||
| ) | ) | ||||
| func newHpcModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultHpcModel { | |||||
| func newHpcModel(conn sqlx.SqlConn) *defaultHpcModel { | |||||
| return &defaultHpcModel{ | return &defaultHpcModel{ | ||||
| CachedConn: sqlc.NewConn(conn, c), | |||||
| table: "`hpc`", | |||||
| conn: conn, | |||||
| table: "`hpc`", | |||||
| } | } | ||||
| } | } | ||||
| func (m *defaultHpcModel) Delete(ctx context.Context, id int64) error { | func (m *defaultHpcModel) Delete(ctx context.Context, id int64) error { | ||||
| pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| return conn.ExecCtx(ctx, query, id) | |||||
| }, pcmHpcIdKey) | |||||
| query := fmt.Sprintf("delete from %s where `id` = ?", m.table) | |||||
| _, err := m.conn.ExecCtx(ctx, query, id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) { | func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) { | ||||
| pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, id) | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table) | |||||
| var resp Hpc | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, id) | |||||
| switch err { | |||||
| case nil: | |||||
| return &resp, nil | |||||
| case sqlc.ErrNotFound: | |||||
| return nil, ErrNotFound | |||||
| default: | |||||
| return nil, err | |||||
| } | |||||
| } | |||||
| func (m *defaultHpcModel) FindOneByServiceNameName(ctx context.Context, serviceName sql.NullString, name sql.NullString) (*Hpc, error) { | |||||
| var resp Hpc | var resp Hpc | ||||
| err := m.QueryRowCtx(ctx, &resp, pcmHpcIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, id) | |||||
| }) | |||||
| query := fmt.Sprintf("select %s from %s where `service_name` = ? and `name` = ? limit 1", hpcRows, m.table) | |||||
| err := m.conn.QueryRowCtx(ctx, &resp, query, serviceName, name) | |||||
| switch err { | switch err { | ||||
| case nil: | case nil: | ||||
| return &resp, nil | return &resp, nil | ||||
| @@ -89,32 +100,17 @@ func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) { | |||||
| } | } | ||||
| func (m *defaultHpcModel) Insert(ctx context.Context, data *Hpc) (sql.Result, error) { | func (m *defaultHpcModel) Insert(ctx context.Context, data *Hpc) (sql.Result, error) { | ||||
| pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, data.Id) | |||||
| ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, hpcRowsExpectAutoSet) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.Name, data.Status, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag) | |||||
| }, pcmHpcIdKey) | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, hpcRowsExpectAutoSet) | |||||
| ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.Name, data.Status, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.WorkDir, data.WallTime, data.Result, data.YamlString) | |||||
| return ret, err | return ret, err | ||||
| } | } | ||||
| func (m *defaultHpcModel) Update(ctx context.Context, data *Hpc) error { | |||||
| pcmHpcIdKey := fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, data.Id) | |||||
| _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, hpcRowsWithPlaceHolder) | |||||
| return conn.ExecCtx(ctx, query, data.TaskId, data.JobId, data.ServiceName, data.Name, data.Status, data.StartTime, data.RunningTime, data.CardCount, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id) | |||||
| }, pcmHpcIdKey) | |||||
| func (m *defaultHpcModel) Update(ctx context.Context, newData *Hpc) error { | |||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, hpcRowsWithPlaceHolder) | |||||
| _, err := m.conn.ExecCtx(ctx, query, newData.TaskId, newData.JobId, newData.ServiceName, newData.Name, newData.Status, newData.StartTime, newData.RunningTime, newData.CardCount, newData.CreatedBy, newData.CreatedTime, newData.UpdatedBy, newData.UpdatedTime, newData.DeletedFlag, newData.WorkDir, newData.WallTime, newData.Result, newData.YamlString, newData.Id) | |||||
| return err | return err | ||||
| } | } | ||||
| func (m *defaultHpcModel) formatPrimary(primary interface{}) string { | |||||
| return fmt.Sprintf("%s%v", cachePcmHpcIdPrefix, primary) | |||||
| } | |||||
| func (m *defaultHpcModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error { | |||||
| query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table) | |||||
| return conn.QueryRowCtx(ctx, v, query, primary) | |||||
| } | |||||
| func (m *defaultHpcModel) tableName() string { | func (m *defaultHpcModel) tableName() string { | ||||
| return m.table | return m.table | ||||
| } | } | ||||
| @@ -36,9 +36,7 @@ type ( | |||||
| } | } | ||||
| Task struct { | Task struct { | ||||
| Id int64 `db:"id"` // id | |||||
| ServiceId int64 `db:"service_id"` // 服务id | |||||
| JobId string `db:"job_id"` | |||||
| Id int64 `db:"id"` // id | |||||
| Name string `db:"name"` // 作业名称 | Name string `db:"name"` // 作业名称 | ||||
| ServiceName string `db:"service_name"` // 服务名称 | ServiceName string `db:"service_name"` // 服务名称 | ||||
| Description string `db:"description"` // 作业描述 | Description string `db:"description"` // 作业描述 | ||||
| @@ -46,7 +44,6 @@ type ( | |||||
| Status string `db:"status"` // 作业状态 | Status string `db:"status"` // 作业状态 | ||||
| Strategy int64 `db:"strategy"` // 策略 | Strategy int64 `db:"strategy"` // 策略 | ||||
| SynergyStatus int64 `db:"synergy_status"` // 协同状态(0-未协同、1-已协同) | SynergyStatus int64 `db:"synergy_status"` // 协同状态(0-未协同、1-已协同) | ||||
| CardCount int64 `db:"card_count"` // 卡数 | |||||
| StartTime time.Time `db:"start_time"` // 开始运行时间 | StartTime time.Time `db:"start_time"` // 开始运行时间 | ||||
| EndTime string `db:"end_time"` // 结束运行时间 | EndTime string `db:"end_time"` // 结束运行时间 | ||||
| RunningTime int64 `db:"running_time"` // 已运行时间(单位秒) | RunningTime int64 `db:"running_time"` // 已运行时间(单位秒) | ||||
| @@ -88,14 +85,14 @@ func (m *defaultTaskModel) FindOne(ctx context.Context, id int64) (*Task, error) | |||||
| } | } | ||||
| func (m *defaultTaskModel) Insert(ctx context.Context, data *Task) (sql.Result, error) { | func (m *defaultTaskModel) Insert(ctx context.Context, data *Task) (sql.Result, error) { | ||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskRowsExpectAutoSet) | |||||
| ret, err := m.conn.ExecCtx(ctx, query, data.ServiceId, data.JobId, data.Name, data.ServiceName, data.Description, data.Kind, data.Status, data.Strategy, data.SynergyStatus, data.CardCount, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag) | |||||
| query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskRowsExpectAutoSet) | |||||
| ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.ServiceName, data.Description, data.Kind, data.Status, data.Strategy, data.SynergyStatus, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag) | |||||
| return ret, err | return ret, err | ||||
| } | } | ||||
| func (m *defaultTaskModel) Update(ctx context.Context, data *Task) error { | func (m *defaultTaskModel) Update(ctx context.Context, data *Task) error { | ||||
| query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskRowsWithPlaceHolder) | query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskRowsWithPlaceHolder) | ||||
| _, err := m.conn.ExecCtx(ctx, query, data.ServiceId, data.JobId, data.Name, data.ServiceName, data.Description, data.Kind, data.Status, data.Strategy, data.SynergyStatus, data.CardCount, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id) | |||||
| _, err := m.conn.ExecCtx(ctx, query, data.Name, data.ServiceName, data.Description, data.Kind, data.Status, data.Strategy, data.SynergyStatus, data.StartTime, data.EndTime, data.RunningTime, data.YamlString, data.Result, data.CreatedBy, data.CreatedTime, data.UpdatedBy, data.UpdatedTime, data.DeletedFlag, data.Id) | |||||
| return err | return err | ||||
| } | } | ||||
| @@ -1,9 +1,10 @@ | |||||
| package logic | package logic | ||||
| import ( | import ( | ||||
| "PCM/adaptor/PCM-CORE/model" | |||||
| "PCM/adaptor/PCM-CORE/rpc/internal/svc" | "PCM/adaptor/PCM-CORE/rpc/internal/svc" | ||||
| "PCM/adaptor/PCM-CORE/rpc/pcmCore" | "PCM/adaptor/PCM-CORE/rpc/pcmCore" | ||||
| result2 "PCM/common/result" | |||||
| "PCM/common/tool" | |||||
| "context" | "context" | ||||
| "github.com/zeromicro/go-zero/core/logx" | "github.com/zeromicro/go-zero/core/logx" | ||||
| @@ -27,45 +28,50 @@ func NewInfoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoList | |||||
| func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp, error) { | func (l *InfoListLogic) InfoList(in *pcmCore.InfoListReq) (*pcmCore.InfoListResp, error) { | ||||
| result := pcmCore.InfoListResp{} | result := pcmCore.InfoListResp{} | ||||
| // 查询云智超中的数据列表 | // 查询云智超中的数据列表 | ||||
| var sql string | |||||
| switch in.Kind { | switch in.Kind { | ||||
| case "hpc": | case "hpc": | ||||
| sql = "select h.task_id,h.name,h.job_id as externalField,h.status from hpc h inner join task t on t.id = h.task_id where h.status not in ('Succeed', 'Completed')" | |||||
| rows, err := l.svcCtx.Db.Query("select task_id,name,status,work_dir,wall_time from hpc where service_name = ? and status not in ('Succeed', 'Completed')", in.ServiceName) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| for rows.Next() { | |||||
| var hpc model.Hpc | |||||
| rows.Scan(&hpc.TaskId, &hpc.Name, &hpc.Status, &hpc.WorkDir, &hpc.WallTime) | |||||
| hpcInfo := pcmCore.HpcInfo{ | |||||
| TaskId: hpc.TaskId.Int64, | |||||
| Name: hpc.Name.String, | |||||
| Status: hpc.Status.String, | |||||
| WorkDir: hpc.WorkDir.String, | |||||
| WallTime: hpc.WallTime.String, | |||||
| } | |||||
| result.HpcInfoList = append(result.HpcInfoList, &hpcInfo) | |||||
| } | |||||
| case "cloud": | case "cloud": | ||||
| sql = "select c.task_id,c.name,c.namespace as externalField,c.status from cloud c inner join task t on t.id = c.task_id where c.status not in ('Succeed', 'Completed')" | |||||
| rows, err := l.svcCtx.Db.Query("select task_id,namespace,name,status from cloud where service_name = ? and status not in ('Succeed', 'Completed')", in.ServiceName) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| for rows.Next() { | |||||
| var cloud model.Cloud | |||||
| rows.Scan(&cloud.TaskId, &cloud.Namespace, &cloud.Name, &cloud.Status) | |||||
| var cloudInfo pcmCore.CloudInfo | |||||
| tool.Convert(cloud, &cloudInfo) | |||||
| result.CloudInfoList = append(result.CloudInfoList, &cloudInfo) | |||||
| } | |||||
| case "ai": | case "ai": | ||||
| sql = "select a.task_id,a.name,a.project_id as externalField,a.status from ai a inner join task t on t.id = a.task_id where a.status not in ('Succeed', 'Completed')" | |||||
| } | |||||
| rows, err := l.svcCtx.Db.Query(sql) | |||||
| if err != nil { | |||||
| logx.Error(err) | |||||
| return nil, result2.NewDefaultError(err.Error()) | |||||
| } | |||||
| for rows.Next() { | |||||
| externalInfo := pcmCore.ExternalInfo{} | |||||
| rows.Scan(&externalInfo.TaskId, &externalInfo.Name, &externalInfo.ExternalField, &externalInfo.Status) | |||||
| result.ExternalInfoList = append(result.ExternalInfoList, &externalInfo) | |||||
| } | |||||
| // 查询待分发的任务列表 | |||||
| taskRows, err := l.svcCtx.Db.Query("select yaml_string from task where status = 'Saved' and kind = ? and service_name = ?", in.Kind, in.ServiceName) | |||||
| var taskIds []int64 | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| for taskRows.Next() { | |||||
| var taskId int64 | |||||
| var yamlString string | |||||
| taskRows.Scan(&taskId, &yamlString) | |||||
| result.YamlString = append(result.YamlString, yamlString) | |||||
| taskIds = append(taskIds, taskId) | |||||
| } | |||||
| // 将任务状态修改为已提交 | |||||
| if taskRows.Next() { | |||||
| execResult, err := l.svcCtx.Db.Exec("update task set status = 'Submitted' where id in (?)", taskIds) | |||||
| rows, err := l.svcCtx.Db.Query("select task_id,name,status from ai where service_name = ? and status not in ('Succeed', 'Completed')", in.ServiceName) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| println(execResult) | |||||
| for rows.Next() { | |||||
| var ai model.Ai | |||||
| rows.Scan(&ai.TaskId, &ai.Name, &ai.Status) | |||||
| var aiInfo pcmCore.AiInfo | |||||
| tool.Convert(ai, &aiInfo) | |||||
| result.AiInfoList = append(result.AiInfoList, &aiInfo) | |||||
| } | |||||
| } | } | ||||
| return &result, nil | return &result, nil | ||||
| } | } | ||||
| @@ -3,7 +3,6 @@ package logic | |||||
| import ( | import ( | ||||
| "PCM/adaptor/PCM-CORE/rpc/internal/svc" | "PCM/adaptor/PCM-CORE/rpc/internal/svc" | ||||
| "PCM/adaptor/PCM-CORE/rpc/pcmCore" | "PCM/adaptor/PCM-CORE/rpc/pcmCore" | ||||
| "PCM/common/tool" | |||||
| "context" | "context" | ||||
| "fmt" | "fmt" | ||||
| "time" | "time" | ||||
| @@ -35,27 +34,57 @@ func NewSyncInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncInfo | |||||
| // SyncInfo Synchronous data information | // SyncInfo Synchronous data information | ||||
| func (l *SyncInfoLogic) SyncInfo(in *pcmCore.SyncInfoReq) (*pcmCore.SyncInfoResp, error) { | func (l *SyncInfoLogic) SyncInfo(in *pcmCore.SyncInfoReq) (*pcmCore.SyncInfoResp, error) { | ||||
| var query string | |||||
| conn, err := l.svcCtx.Db.Begin() | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| switch in.Kind { | switch in.Kind { | ||||
| case "cloud": | case "cloud": | ||||
| query = "INSERT INTO cloud (service_name,task_id, namespace,name,status,running_time,start_time) VALUES " | |||||
| for _, cloudInfo := range in.CloudInfoList { | |||||
| _, err = conn.Exec("update cloud set status = ?,start_time = ?,running_time = ? where service_name = ? and task_id = ? and namespace = ? and name = ?", | |||||
| cloudInfo.Status, cloudInfo.StartTime, cloudInfo.RunningTime, cloudInfo.ServiceName, cloudInfo.TaskId, cloudInfo.Namespace, cloudInfo.Name) | |||||
| } | |||||
| case "hpc": | case "hpc": | ||||
| query = "INSERT INTO hpc (service_name,task_id,job_id,name,status,running_time,start_time) VALUES " | |||||
| for _, hpcInfo := range in.HpcInfoList { | |||||
| _, err = conn.Exec("update hpc set status = ?,start_time = ?,running_time = ?,job_id = ? where service_name = ? and task_id = ? and name = ?", | |||||
| hpcInfo.Status, hpcInfo.StartTime, hpcInfo.RunningTime, hpcInfo.JobId, in.ServiceName, hpcInfo.TaskId, hpcInfo.Name) | |||||
| } | |||||
| case "ai": | case "ai": | ||||
| query = "INSERT INTO ai (service_name,task_id,project_id,name,status,running_time,start_time) VALUES " | |||||
| } | |||||
| for i, info := range in.LatestExternalInfoList { | |||||
| if i > 0 { | |||||
| query += "," | |||||
| for _, aiInfo := range in.AiInfoList { | |||||
| _, err = conn.Exec("update ai set status = ?,start_time = ?,running_time = ?,project_id = ? where service_name = ? and task_id = ? and name = ?", | |||||
| aiInfo.Status, aiInfo.StartTime, aiInfo.RunningTime, aiInfo.ProjectId, aiInfo.ServiceName, aiInfo.TaskId, aiInfo.Name) | |||||
| } | } | ||||
| query += fmt.Sprintf("('%s',%d,'%s','%s','%s',%d,'%s')", info.ServiceName, info.TaskId, info.ExternalField, info.Name, info.Status, info.RunningTime, tool.TimeStringRemoveZone(info.StartTime)) | |||||
| } | } | ||||
| query += " ON DUPLICATE KEY UPDATE status=VALUES(status),start_time=VALUES(start_time),running_time=VALUES(running_time)" | |||||
| _, err := l.svcCtx.Db.Exec(query) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| defer func() { | |||||
| if p := recover(); p != nil { | |||||
| conn.Rollback() | |||||
| panic(p) | |||||
| } else if err != nil { | |||||
| fmt.Println("rollback") | |||||
| conn.Rollback() | |||||
| } else { | |||||
| err = conn.Commit() | |||||
| fmt.Println("commit success") | |||||
| } | |||||
| }() | |||||
| return &pcmCore.SyncInfoResp{}, nil | return &pcmCore.SyncInfoResp{}, nil | ||||
| } | } | ||||
| func SyncHpcInfo(query string, HpcInfoList []*pcmCore.HpcInfo) { | |||||
| //query = "INSERT INTO cloud (service_name,task_id, job_id,name,status,running_time,start_time) VALUES " | |||||
| //for i, info := range HpcInfoList { | |||||
| // if i > 0 { | |||||
| // query += "," | |||||
| // } | |||||
| // | |||||
| // query += fmt.Sprintf("('%s',%d,'%s','%s','%s',%d,'%s')", info.ServiceName, info.TaskId, info.JobId, info.Name, info.Status, info.RunningTime, tool.TimeStringRemoveZone(info.StartTime)) | |||||
| //} | |||||
| //query += " ON DUPLICATE KEY UPDATE status=VALUES(status),start_time=VALUES(start_time),running_time=VALUES(running_time),job_id=VALUES(job_id)," | |||||
| } | |||||
| @@ -4,18 +4,50 @@ package pcmCore; | |||||
| option go_package = "/pcmCore"; | option go_package = "/pcmCore"; | ||||
| message SyncInfoReq { | message SyncInfoReq { | ||||
| string kind =1; | |||||
| repeated LatestExternalInfo latestExternalInfoList = 2; | |||||
| string serviceName = 1; | |||||
| string kind = 2; | |||||
| repeated HpcInfo HpcInfoList = 3; | |||||
| repeated CloudInfo CloudInfoList = 4; | |||||
| repeated AiInfo AiInfoList = 5; | |||||
| } | } | ||||
| message LatestExternalInfo { | |||||
| message AiInfo { | |||||
| string serviceName = 1; | string serviceName = 1; | ||||
| int64 taskId = 2; | int64 taskId = 2; | ||||
| string externalField = 3; | |||||
| string project_id = 3; | |||||
| string name = 4; | string name = 4; | ||||
| string status = 5; | string status = 5; | ||||
| string startTime = 6; | string startTime = 6; | ||||
| int64 runningTime = 7; | int64 runningTime = 7; | ||||
| string result = 8; | |||||
| } | |||||
| message CloudInfo { | |||||
| string serviceName = 1; | |||||
| int64 taskId = 2; | |||||
| string apiVersion = 3; | |||||
| string kind = 4; | |||||
| string namespace = 5; | |||||
| string name = 6; | |||||
| string status = 7; | |||||
| string startTime = 8; | |||||
| int64 runningTime = 9; | |||||
| string result = 10; | |||||
| string yamlString = 11; | |||||
| } | |||||
| message HpcInfo { | |||||
| string serviceName = 1; | |||||
| int64 taskId = 2; | |||||
| string jobId = 3; | |||||
| string name = 4; | |||||
| string status = 5; | |||||
| string startTime = 6; | |||||
| int64 runningTime = 7; | |||||
| string result = 8; | |||||
| string workDir = 9; | |||||
| string wallTime = 10; | |||||
| } | } | ||||
| message SyncInfoResp{ | message SyncInfoResp{ | ||||
| @@ -29,16 +61,11 @@ message InfoListReq{ | |||||
| } | } | ||||
| message InfoListResp{ | message InfoListResp{ | ||||
| repeated string yamlString =1; | |||||
| repeated ExternalInfo externalInfoList = 2; | |||||
| repeated HpcInfo HpcInfoList = 1; | |||||
| repeated CloudInfo CloudInfoList = 2; | |||||
| repeated AiInfo AiInfoList = 3; | |||||
| } | } | ||||
| message ExternalInfo { | |||||
| int64 taskId = 1; | |||||
| string externalField = 2; | |||||
| string name = 3; | |||||
| string status = 4; | |||||
| } | |||||
| // pcm core services | // pcm core services | ||||
| @@ -25,8 +25,11 @@ type SyncInfoReq struct { | |||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` | |||||
| LatestExternalInfoList []*LatestExternalInfo `protobuf:"bytes,2,rep,name=latestExternalInfoList,proto3" json:"latestExternalInfoList,omitempty"` | |||||
| ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` | |||||
| HpcInfoList []*HpcInfo `protobuf:"bytes,3,rep,name=HpcInfoList,proto3" json:"HpcInfoList,omitempty"` | |||||
| CloudInfoList []*CloudInfo `protobuf:"bytes,4,rep,name=CloudInfoList,proto3" json:"CloudInfoList,omitempty"` | |||||
| AiInfoList []*AiInfo `protobuf:"bytes,5,rep,name=AiInfoList,proto3" json:"AiInfoList,omitempty"` | |||||
| } | } | ||||
| func (x *SyncInfoReq) Reset() { | func (x *SyncInfoReq) Reset() { | ||||
| @@ -61,6 +64,13 @@ func (*SyncInfoReq) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{0} | return file_pcmCore_proto_rawDescGZIP(), []int{0} | ||||
| } | } | ||||
| func (x *SyncInfoReq) GetServiceName() string { | |||||
| if x != nil { | |||||
| return x.ServiceName | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *SyncInfoReq) GetKind() string { | func (x *SyncInfoReq) GetKind() string { | ||||
| if x != nil { | if x != nil { | ||||
| return x.Kind | return x.Kind | ||||
| @@ -68,29 +78,44 @@ func (x *SyncInfoReq) GetKind() string { | |||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *SyncInfoReq) GetLatestExternalInfoList() []*LatestExternalInfo { | |||||
| func (x *SyncInfoReq) GetHpcInfoList() []*HpcInfo { | |||||
| if x != nil { | if x != nil { | ||||
| return x.LatestExternalInfoList | |||||
| return x.HpcInfoList | |||||
| } | } | ||||
| return nil | return nil | ||||
| } | } | ||||
| type LatestExternalInfo struct { | |||||
| func (x *SyncInfoReq) GetCloudInfoList() []*CloudInfo { | |||||
| if x != nil { | |||||
| return x.CloudInfoList | |||||
| } | |||||
| return nil | |||||
| } | |||||
| func (x *SyncInfoReq) GetAiInfoList() []*AiInfo { | |||||
| if x != nil { | |||||
| return x.AiInfoList | |||||
| } | |||||
| return nil | |||||
| } | |||||
| type AiInfo struct { | |||||
| state protoimpl.MessageState | state protoimpl.MessageState | ||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"` | |||||
| ExternalField string `protobuf:"bytes,3,opt,name=externalField,proto3" json:"externalField,omitempty"` | |||||
| Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` | |||||
| Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` | |||||
| StartTime string `protobuf:"bytes,6,opt,name=startTime,proto3" json:"startTime,omitempty"` | |||||
| RunningTime int64 `protobuf:"varint,7,opt,name=runningTime,proto3" json:"runningTime,omitempty"` | |||||
| ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"` | |||||
| ProjectId string `protobuf:"bytes,3,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` | |||||
| Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` | |||||
| Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` | |||||
| StartTime string `protobuf:"bytes,6,opt,name=startTime,proto3" json:"startTime,omitempty"` | |||||
| RunningTime int64 `protobuf:"varint,7,opt,name=runningTime,proto3" json:"runningTime,omitempty"` | |||||
| Result string `protobuf:"bytes,8,opt,name=result,proto3" json:"result,omitempty"` | |||||
| } | } | ||||
| func (x *LatestExternalInfo) Reset() { | |||||
| *x = LatestExternalInfo{} | |||||
| func (x *AiInfo) Reset() { | |||||
| *x = AiInfo{} | |||||
| if protoimpl.UnsafeEnabled { | if protoimpl.UnsafeEnabled { | ||||
| mi := &file_pcmCore_proto_msgTypes[1] | mi := &file_pcmCore_proto_msgTypes[1] | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -98,13 +123,13 @@ func (x *LatestExternalInfo) Reset() { | |||||
| } | } | ||||
| } | } | ||||
| func (x *LatestExternalInfo) String() string { | |||||
| func (x *AiInfo) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | return protoimpl.X.MessageStringOf(x) | ||||
| } | } | ||||
| func (*LatestExternalInfo) ProtoMessage() {} | |||||
| func (*AiInfo) ProtoMessage() {} | |||||
| func (x *LatestExternalInfo) ProtoReflect() protoreflect.Message { | |||||
| func (x *AiInfo) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[1] | mi := &file_pcmCore_proto_msgTypes[1] | ||||
| if protoimpl.UnsafeEnabled && x != nil { | if protoimpl.UnsafeEnabled && x != nil { | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -116,71 +141,87 @@ func (x *LatestExternalInfo) ProtoReflect() protoreflect.Message { | |||||
| return mi.MessageOf(x) | return mi.MessageOf(x) | ||||
| } | } | ||||
| // Deprecated: Use LatestExternalInfo.ProtoReflect.Descriptor instead. | |||||
| func (*LatestExternalInfo) Descriptor() ([]byte, []int) { | |||||
| // Deprecated: Use AiInfo.ProtoReflect.Descriptor instead. | |||||
| func (*AiInfo) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{1} | return file_pcmCore_proto_rawDescGZIP(), []int{1} | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetServiceName() string { | |||||
| func (x *AiInfo) GetServiceName() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.ServiceName | return x.ServiceName | ||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetTaskId() int64 { | |||||
| func (x *AiInfo) GetTaskId() int64 { | |||||
| if x != nil { | if x != nil { | ||||
| return x.TaskId | return x.TaskId | ||||
| } | } | ||||
| return 0 | return 0 | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetExternalField() string { | |||||
| func (x *AiInfo) GetProjectId() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.ExternalField | |||||
| return x.ProjectId | |||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetName() string { | |||||
| func (x *AiInfo) GetName() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Name | return x.Name | ||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetStatus() string { | |||||
| func (x *AiInfo) GetStatus() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Status | return x.Status | ||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetStartTime() string { | |||||
| func (x *AiInfo) GetStartTime() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.StartTime | return x.StartTime | ||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *LatestExternalInfo) GetRunningTime() int64 { | |||||
| func (x *AiInfo) GetRunningTime() int64 { | |||||
| if x != nil { | if x != nil { | ||||
| return x.RunningTime | return x.RunningTime | ||||
| } | } | ||||
| return 0 | return 0 | ||||
| } | } | ||||
| type SyncInfoResp struct { | |||||
| func (x *AiInfo) GetResult() string { | |||||
| if x != nil { | |||||
| return x.Result | |||||
| } | |||||
| return "" | |||||
| } | |||||
| type CloudInfo struct { | |||||
| state protoimpl.MessageState | state protoimpl.MessageState | ||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` | |||||
| Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` | |||||
| } | |||||
| func (x *SyncInfoResp) Reset() { | |||||
| *x = SyncInfoResp{} | |||||
| ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"` | |||||
| ApiVersion string `protobuf:"bytes,3,opt,name=apiVersion,proto3" json:"apiVersion,omitempty"` | |||||
| Kind string `protobuf:"bytes,4,opt,name=kind,proto3" json:"kind,omitempty"` | |||||
| Namespace string `protobuf:"bytes,5,opt,name=namespace,proto3" json:"namespace,omitempty"` | |||||
| Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` | |||||
| Status string `protobuf:"bytes,7,opt,name=status,proto3" json:"status,omitempty"` | |||||
| StartTime string `protobuf:"bytes,8,opt,name=startTime,proto3" json:"startTime,omitempty"` | |||||
| RunningTime int64 `protobuf:"varint,9,opt,name=runningTime,proto3" json:"runningTime,omitempty"` | |||||
| Result string `protobuf:"bytes,10,opt,name=result,proto3" json:"result,omitempty"` | |||||
| YamlString string `protobuf:"bytes,11,opt,name=yamlString,proto3" json:"yamlString,omitempty"` | |||||
| } | |||||
| func (x *CloudInfo) Reset() { | |||||
| *x = CloudInfo{} | |||||
| if protoimpl.UnsafeEnabled { | if protoimpl.UnsafeEnabled { | ||||
| mi := &file_pcmCore_proto_msgTypes[2] | mi := &file_pcmCore_proto_msgTypes[2] | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -188,13 +229,13 @@ func (x *SyncInfoResp) Reset() { | |||||
| } | } | ||||
| } | } | ||||
| func (x *SyncInfoResp) String() string { | |||||
| func (x *CloudInfo) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | return protoimpl.X.MessageStringOf(x) | ||||
| } | } | ||||
| func (*SyncInfoResp) ProtoMessage() {} | |||||
| func (*CloudInfo) ProtoMessage() {} | |||||
| func (x *SyncInfoResp) ProtoReflect() protoreflect.Message { | |||||
| func (x *CloudInfo) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[2] | mi := &file_pcmCore_proto_msgTypes[2] | ||||
| if protoimpl.UnsafeEnabled && x != nil { | if protoimpl.UnsafeEnabled && x != nil { | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -206,36 +247,107 @@ func (x *SyncInfoResp) ProtoReflect() protoreflect.Message { | |||||
| return mi.MessageOf(x) | return mi.MessageOf(x) | ||||
| } | } | ||||
| // Deprecated: Use SyncInfoResp.ProtoReflect.Descriptor instead. | |||||
| func (*SyncInfoResp) Descriptor() ([]byte, []int) { | |||||
| // Deprecated: Use CloudInfo.ProtoReflect.Descriptor instead. | |||||
| func (*CloudInfo) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{2} | return file_pcmCore_proto_rawDescGZIP(), []int{2} | ||||
| } | } | ||||
| func (x *SyncInfoResp) GetCode() int64 { | |||||
| func (x *CloudInfo) GetServiceName() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Code | |||||
| return x.ServiceName | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetTaskId() int64 { | |||||
| if x != nil { | |||||
| return x.TaskId | |||||
| } | } | ||||
| return 0 | return 0 | ||||
| } | } | ||||
| func (x *SyncInfoResp) GetMsg() string { | |||||
| func (x *CloudInfo) GetApiVersion() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Msg | |||||
| return x.ApiVersion | |||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| type InfoListReq struct { | |||||
| func (x *CloudInfo) GetKind() string { | |||||
| if x != nil { | |||||
| return x.Kind | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetNamespace() string { | |||||
| if x != nil { | |||||
| return x.Namespace | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetName() string { | |||||
| if x != nil { | |||||
| return x.Name | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetStatus() string { | |||||
| if x != nil { | |||||
| return x.Status | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetStartTime() string { | |||||
| if x != nil { | |||||
| return x.StartTime | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetRunningTime() int64 { | |||||
| if x != nil { | |||||
| return x.RunningTime | |||||
| } | |||||
| return 0 | |||||
| } | |||||
| func (x *CloudInfo) GetResult() string { | |||||
| if x != nil { | |||||
| return x.Result | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *CloudInfo) GetYamlString() string { | |||||
| if x != nil { | |||||
| return x.YamlString | |||||
| } | |||||
| return "" | |||||
| } | |||||
| type HpcInfo struct { | |||||
| state protoimpl.MessageState | state protoimpl.MessageState | ||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` | |||||
| ServiceName string `protobuf:"bytes,2,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"` | |||||
| JobId string `protobuf:"bytes,3,opt,name=jobId,proto3" json:"jobId,omitempty"` | |||||
| Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` | |||||
| Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` | |||||
| StartTime string `protobuf:"bytes,6,opt,name=startTime,proto3" json:"startTime,omitempty"` | |||||
| RunningTime int64 `protobuf:"varint,7,opt,name=runningTime,proto3" json:"runningTime,omitempty"` | |||||
| Result string `protobuf:"bytes,8,opt,name=result,proto3" json:"result,omitempty"` | |||||
| WorkDir string `protobuf:"bytes,9,opt,name=workDir,proto3" json:"workDir,omitempty"` | |||||
| WallTime string `protobuf:"bytes,10,opt,name=wallTime,proto3" json:"wallTime,omitempty"` | |||||
| } | } | ||||
| func (x *InfoListReq) Reset() { | |||||
| *x = InfoListReq{} | |||||
| func (x *HpcInfo) Reset() { | |||||
| *x = HpcInfo{} | |||||
| if protoimpl.UnsafeEnabled { | if protoimpl.UnsafeEnabled { | ||||
| mi := &file_pcmCore_proto_msgTypes[3] | mi := &file_pcmCore_proto_msgTypes[3] | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -243,13 +355,13 @@ func (x *InfoListReq) Reset() { | |||||
| } | } | ||||
| } | } | ||||
| func (x *InfoListReq) String() string { | |||||
| func (x *HpcInfo) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | return protoimpl.X.MessageStringOf(x) | ||||
| } | } | ||||
| func (*InfoListReq) ProtoMessage() {} | |||||
| func (*HpcInfo) ProtoMessage() {} | |||||
| func (x *InfoListReq) ProtoReflect() protoreflect.Message { | |||||
| func (x *HpcInfo) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[3] | mi := &file_pcmCore_proto_msgTypes[3] | ||||
| if protoimpl.UnsafeEnabled && x != nil { | if protoimpl.UnsafeEnabled && x != nil { | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -261,36 +373,92 @@ func (x *InfoListReq) ProtoReflect() protoreflect.Message { | |||||
| return mi.MessageOf(x) | return mi.MessageOf(x) | ||||
| } | } | ||||
| // Deprecated: Use InfoListReq.ProtoReflect.Descriptor instead. | |||||
| func (*InfoListReq) Descriptor() ([]byte, []int) { | |||||
| // Deprecated: Use HpcInfo.ProtoReflect.Descriptor instead. | |||||
| func (*HpcInfo) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{3} | return file_pcmCore_proto_rawDescGZIP(), []int{3} | ||||
| } | } | ||||
| func (x *InfoListReq) GetKind() string { | |||||
| func (x *HpcInfo) GetServiceName() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Kind | |||||
| return x.ServiceName | |||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *InfoListReq) GetServiceName() string { | |||||
| func (x *HpcInfo) GetTaskId() int64 { | |||||
| if x != nil { | if x != nil { | ||||
| return x.ServiceName | |||||
| return x.TaskId | |||||
| } | |||||
| return 0 | |||||
| } | |||||
| func (x *HpcInfo) GetJobId() string { | |||||
| if x != nil { | |||||
| return x.JobId | |||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| type InfoListResp struct { | |||||
| func (x *HpcInfo) GetName() string { | |||||
| if x != nil { | |||||
| return x.Name | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *HpcInfo) GetStatus() string { | |||||
| if x != nil { | |||||
| return x.Status | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *HpcInfo) GetStartTime() string { | |||||
| if x != nil { | |||||
| return x.StartTime | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *HpcInfo) GetRunningTime() int64 { | |||||
| if x != nil { | |||||
| return x.RunningTime | |||||
| } | |||||
| return 0 | |||||
| } | |||||
| func (x *HpcInfo) GetResult() string { | |||||
| if x != nil { | |||||
| return x.Result | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *HpcInfo) GetWorkDir() string { | |||||
| if x != nil { | |||||
| return x.WorkDir | |||||
| } | |||||
| return "" | |||||
| } | |||||
| func (x *HpcInfo) GetWallTime() string { | |||||
| if x != nil { | |||||
| return x.WallTime | |||||
| } | |||||
| return "" | |||||
| } | |||||
| type SyncInfoResp struct { | |||||
| state protoimpl.MessageState | state protoimpl.MessageState | ||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| YamlString []string `protobuf:"bytes,1,rep,name=yamlString,proto3" json:"yamlString,omitempty"` | |||||
| ExternalInfoList []*ExternalInfo `protobuf:"bytes,2,rep,name=externalInfoList,proto3" json:"externalInfoList,omitempty"` | |||||
| Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` | |||||
| Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` | |||||
| } | } | ||||
| func (x *InfoListResp) Reset() { | |||||
| *x = InfoListResp{} | |||||
| func (x *SyncInfoResp) Reset() { | |||||
| *x = SyncInfoResp{} | |||||
| if protoimpl.UnsafeEnabled { | if protoimpl.UnsafeEnabled { | ||||
| mi := &file_pcmCore_proto_msgTypes[4] | mi := &file_pcmCore_proto_msgTypes[4] | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -298,13 +466,13 @@ func (x *InfoListResp) Reset() { | |||||
| } | } | ||||
| } | } | ||||
| func (x *InfoListResp) String() string { | |||||
| func (x *SyncInfoResp) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | return protoimpl.X.MessageStringOf(x) | ||||
| } | } | ||||
| func (*InfoListResp) ProtoMessage() {} | |||||
| func (*SyncInfoResp) ProtoMessage() {} | |||||
| func (x *InfoListResp) ProtoReflect() protoreflect.Message { | |||||
| func (x *SyncInfoResp) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[4] | mi := &file_pcmCore_proto_msgTypes[4] | ||||
| if protoimpl.UnsafeEnabled && x != nil { | if protoimpl.UnsafeEnabled && x != nil { | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -316,38 +484,36 @@ func (x *InfoListResp) ProtoReflect() protoreflect.Message { | |||||
| return mi.MessageOf(x) | return mi.MessageOf(x) | ||||
| } | } | ||||
| // Deprecated: Use InfoListResp.ProtoReflect.Descriptor instead. | |||||
| func (*InfoListResp) Descriptor() ([]byte, []int) { | |||||
| // Deprecated: Use SyncInfoResp.ProtoReflect.Descriptor instead. | |||||
| func (*SyncInfoResp) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{4} | return file_pcmCore_proto_rawDescGZIP(), []int{4} | ||||
| } | } | ||||
| func (x *InfoListResp) GetYamlString() []string { | |||||
| func (x *SyncInfoResp) GetCode() int64 { | |||||
| if x != nil { | if x != nil { | ||||
| return x.YamlString | |||||
| return x.Code | |||||
| } | } | ||||
| return nil | |||||
| return 0 | |||||
| } | } | ||||
| func (x *InfoListResp) GetExternalInfoList() []*ExternalInfo { | |||||
| func (x *SyncInfoResp) GetMsg() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.ExternalInfoList | |||||
| return x.Msg | |||||
| } | } | ||||
| return nil | |||||
| return "" | |||||
| } | } | ||||
| type ExternalInfo struct { | |||||
| type InfoListReq struct { | |||||
| state protoimpl.MessageState | state protoimpl.MessageState | ||||
| sizeCache protoimpl.SizeCache | sizeCache protoimpl.SizeCache | ||||
| unknownFields protoimpl.UnknownFields | unknownFields protoimpl.UnknownFields | ||||
| TaskId int64 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId,omitempty"` | |||||
| ExternalField string `protobuf:"bytes,2,opt,name=externalField,proto3" json:"externalField,omitempty"` | |||||
| Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` | |||||
| Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` | |||||
| Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` | |||||
| ServiceName string `protobuf:"bytes,2,opt,name=serviceName,proto3" json:"serviceName,omitempty"` | |||||
| } | } | ||||
| func (x *ExternalInfo) Reset() { | |||||
| *x = ExternalInfo{} | |||||
| func (x *InfoListReq) Reset() { | |||||
| *x = InfoListReq{} | |||||
| if protoimpl.UnsafeEnabled { | if protoimpl.UnsafeEnabled { | ||||
| mi := &file_pcmCore_proto_msgTypes[5] | mi := &file_pcmCore_proto_msgTypes[5] | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -355,13 +521,13 @@ func (x *ExternalInfo) Reset() { | |||||
| } | } | ||||
| } | } | ||||
| func (x *ExternalInfo) String() string { | |||||
| func (x *InfoListReq) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | return protoimpl.X.MessageStringOf(x) | ||||
| } | } | ||||
| func (*ExternalInfo) ProtoMessage() {} | |||||
| func (*InfoListReq) ProtoMessage() {} | |||||
| func (x *ExternalInfo) ProtoReflect() protoreflect.Message { | |||||
| func (x *InfoListReq) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[5] | mi := &file_pcmCore_proto_msgTypes[5] | ||||
| if protoimpl.UnsafeEnabled && x != nil { | if protoimpl.UnsafeEnabled && x != nil { | ||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||||
| @@ -373,97 +539,187 @@ func (x *ExternalInfo) ProtoReflect() protoreflect.Message { | |||||
| return mi.MessageOf(x) | return mi.MessageOf(x) | ||||
| } | } | ||||
| // Deprecated: Use ExternalInfo.ProtoReflect.Descriptor instead. | |||||
| func (*ExternalInfo) Descriptor() ([]byte, []int) { | |||||
| // Deprecated: Use InfoListReq.ProtoReflect.Descriptor instead. | |||||
| func (*InfoListReq) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{5} | return file_pcmCore_proto_rawDescGZIP(), []int{5} | ||||
| } | } | ||||
| func (x *ExternalInfo) GetTaskId() int64 { | |||||
| func (x *InfoListReq) GetKind() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.TaskId | |||||
| return x.Kind | |||||
| } | } | ||||
| return 0 | |||||
| return "" | |||||
| } | } | ||||
| func (x *ExternalInfo) GetExternalField() string { | |||||
| func (x *InfoListReq) GetServiceName() string { | |||||
| if x != nil { | if x != nil { | ||||
| return x.ExternalField | |||||
| return x.ServiceName | |||||
| } | } | ||||
| return "" | return "" | ||||
| } | } | ||||
| func (x *ExternalInfo) GetName() string { | |||||
| type InfoListResp struct { | |||||
| state protoimpl.MessageState | |||||
| sizeCache protoimpl.SizeCache | |||||
| unknownFields protoimpl.UnknownFields | |||||
| HpcInfoList []*HpcInfo `protobuf:"bytes,1,rep,name=HpcInfoList,proto3" json:"HpcInfoList,omitempty"` | |||||
| CloudInfoList []*CloudInfo `protobuf:"bytes,2,rep,name=CloudInfoList,proto3" json:"CloudInfoList,omitempty"` | |||||
| AiInfoList []*AiInfo `protobuf:"bytes,3,rep,name=AiInfoList,proto3" json:"AiInfoList,omitempty"` | |||||
| } | |||||
| func (x *InfoListResp) Reset() { | |||||
| *x = InfoListResp{} | |||||
| if protoimpl.UnsafeEnabled { | |||||
| mi := &file_pcmCore_proto_msgTypes[6] | |||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | |||||
| ms.StoreMessageInfo(mi) | |||||
| } | |||||
| } | |||||
| func (x *InfoListResp) String() string { | |||||
| return protoimpl.X.MessageStringOf(x) | |||||
| } | |||||
| func (*InfoListResp) ProtoMessage() {} | |||||
| func (x *InfoListResp) ProtoReflect() protoreflect.Message { | |||||
| mi := &file_pcmCore_proto_msgTypes[6] | |||||
| if protoimpl.UnsafeEnabled && x != nil { | |||||
| ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | |||||
| if ms.LoadMessageInfo() == nil { | |||||
| ms.StoreMessageInfo(mi) | |||||
| } | |||||
| return ms | |||||
| } | |||||
| return mi.MessageOf(x) | |||||
| } | |||||
| // Deprecated: Use InfoListResp.ProtoReflect.Descriptor instead. | |||||
| func (*InfoListResp) Descriptor() ([]byte, []int) { | |||||
| return file_pcmCore_proto_rawDescGZIP(), []int{6} | |||||
| } | |||||
| func (x *InfoListResp) GetHpcInfoList() []*HpcInfo { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Name | |||||
| return x.HpcInfoList | |||||
| } | } | ||||
| return "" | |||||
| return nil | |||||
| } | } | ||||
| func (x *ExternalInfo) GetStatus() string { | |||||
| func (x *InfoListResp) GetCloudInfoList() []*CloudInfo { | |||||
| if x != nil { | if x != nil { | ||||
| return x.Status | |||||
| return x.CloudInfoList | |||||
| } | } | ||||
| return "" | |||||
| return nil | |||||
| } | |||||
| func (x *InfoListResp) GetAiInfoList() []*AiInfo { | |||||
| if x != nil { | |||||
| return x.AiInfoList | |||||
| } | |||||
| return nil | |||||
| } | } | ||||
| var File_pcmCore_proto protoreflect.FileDescriptor | var File_pcmCore_proto protoreflect.FileDescriptor | ||||
| var file_pcmCore_proto_rawDesc = []byte{ | var file_pcmCore_proto_rawDesc = []byte{ | ||||
| 0x0a, 0x0d, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, | 0x0a, 0x0d, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, | ||||
| 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x22, 0x76, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, | |||||
| 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, | |||||
| 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x53, 0x0a, 0x16, 0x6c, | |||||
| 0x61, 0x74, 0x65, 0x73, 0x74, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, | |||||
| 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x63, | |||||
| 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x45, 0x78, 0x74, 0x65, | |||||
| 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x16, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, | |||||
| 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, | |||||
| 0x22, 0xe0, 0x01, 0x0a, 0x12, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x45, 0x78, 0x74, 0x65, 0x72, | |||||
| 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, | |||||
| 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, | |||||
| 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, | |||||
| 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, | |||||
| 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, | |||||
| 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, | |||||
| 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, | |||||
| 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, | |||||
| 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, | |||||
| 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, | |||||
| 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, | |||||
| 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, | |||||
| 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, | |||||
| 0x69, 0x6d, 0x65, 0x22, 0x34, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, | |||||
| 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, | |||||
| 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, | |||||
| 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x43, 0x0a, 0x0b, 0x49, 0x6e, 0x66, | |||||
| 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, | |||||
| 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, | |||||
| 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, | |||||
| 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x71, | |||||
| 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, | |||||
| 0x0a, 0x0a, 0x79, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, | |||||
| 0x28, 0x09, 0x52, 0x0a, 0x79, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x41, | |||||
| 0x0a, 0x10, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, | |||||
| 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, | |||||
| 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, | |||||
| 0x10, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, | |||||
| 0x74, 0x22, 0x78, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, | |||||
| 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, | |||||
| 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x78, 0x74, | |||||
| 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, | |||||
| 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, | |||||
| 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, | |||||
| 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, | |||||
| 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x7b, 0x0a, 0x07, 0x70, | |||||
| 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, | |||||
| 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, | |||||
| 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, | |||||
| 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, | |||||
| 0x37, 0x0a, 0x08, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, | |||||
| 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, | |||||
| 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, | |||||
| 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, | |||||
| 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | |||||
| 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x22, 0xe2, 0x01, 0x0a, 0x0b, 0x53, 0x79, 0x6e, | |||||
| 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, | |||||
| 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, | |||||
| 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, | |||||
| 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x32, | |||||
| 0x0a, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, | |||||
| 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x70, | |||||
| 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, | |||||
| 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, | |||||
| 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x63, 0x6d, 0x43, | |||||
| 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0d, 0x43, | |||||
| 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x0a, | |||||
| 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, | |||||
| 0x32, 0x0f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x69, 0x49, 0x6e, 0x66, | |||||
| 0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xe5, 0x01, | |||||
| 0x0a, 0x06, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, | |||||
| 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, | |||||
| 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, | |||||
| 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, | |||||
| 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, | |||||
| 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, | |||||
| 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, | |||||
| 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, | |||||
| 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, | |||||
| 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, | |||||
| 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, | |||||
| 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, | |||||
| 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, | |||||
| 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, | |||||
| 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xbb, 0x02, 0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, | |||||
| 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, | |||||
| 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, | |||||
| 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, | |||||
| 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, | |||||
| 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, | |||||
| 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, | |||||
| 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, | |||||
| 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, | |||||
| 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, | |||||
| 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, | |||||
| 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, | |||||
| 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, | |||||
| 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, | |||||
| 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, | |||||
| 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, | |||||
| 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, | |||||
| 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, | |||||
| 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x79, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, 0x69, 0x6e, | |||||
| 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x79, 0x61, 0x6d, 0x6c, 0x53, 0x74, 0x72, | |||||
| 0x69, 0x6e, 0x67, 0x22, 0x93, 0x02, 0x0a, 0x07, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, | |||||
| 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, | |||||
| 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, | |||||
| 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, | |||||
| 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6a, 0x6f, 0x62, | |||||
| 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, | |||||
| 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, | |||||
| 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, | |||||
| 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, | |||||
| 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, | |||||
| 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, | |||||
| 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, | |||||
| 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, | |||||
| 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, | |||||
| 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x69, 0x72, 0x18, 0x09, | |||||
| 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x1a, 0x0a, | |||||
| 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, | |||||
| 0x08, 0x77, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x34, 0x0a, 0x0c, 0x53, 0x79, 0x6e, | |||||
| 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, | |||||
| 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, | |||||
| 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, | |||||
| 0x43, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, | |||||
| 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, | |||||
| 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, | |||||
| 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, | |||||
| 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xad, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, | |||||
| 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x0b, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, | |||||
| 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x63, 0x6d, | |||||
| 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x48, 0x70, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x48, 0x70, | |||||
| 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, | |||||
| 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, | |||||
| 0x32, 0x12, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, | |||||
| 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x4c, | |||||
| 0x69, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, | |||||
| 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, | |||||
| 0x65, 0x2e, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x41, 0x69, 0x49, 0x6e, 0x66, 0x6f, | |||||
| 0x4c, 0x69, 0x73, 0x74, 0x32, 0x7b, 0x0a, 0x07, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x12, | |||||
| 0x37, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x70, 0x63, | |||||
| 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, | |||||
| 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, | |||||
| 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x08, 0x49, 0x6e, 0x66, 0x6f, | |||||
| 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, | |||||
| 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, | |||||
| 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, | |||||
| 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, | |||||
| 0x72, 0x6f, 0x74, 0x6f, 0x33, | |||||
| } | } | ||||
| var ( | var ( | ||||
| @@ -478,27 +734,32 @@ func file_pcmCore_proto_rawDescGZIP() []byte { | |||||
| return file_pcmCore_proto_rawDescData | return file_pcmCore_proto_rawDescData | ||||
| } | } | ||||
| var file_pcmCore_proto_msgTypes = make([]protoimpl.MessageInfo, 6) | |||||
| var file_pcmCore_proto_msgTypes = make([]protoimpl.MessageInfo, 7) | |||||
| var file_pcmCore_proto_goTypes = []interface{}{ | var file_pcmCore_proto_goTypes = []interface{}{ | ||||
| (*SyncInfoReq)(nil), // 0: pcmCore.SyncInfoReq | |||||
| (*LatestExternalInfo)(nil), // 1: pcmCore.LatestExternalInfo | |||||
| (*SyncInfoResp)(nil), // 2: pcmCore.SyncInfoResp | |||||
| (*InfoListReq)(nil), // 3: pcmCore.InfoListReq | |||||
| (*InfoListResp)(nil), // 4: pcmCore.InfoListResp | |||||
| (*ExternalInfo)(nil), // 5: pcmCore.ExternalInfo | |||||
| (*SyncInfoReq)(nil), // 0: pcmCore.SyncInfoReq | |||||
| (*AiInfo)(nil), // 1: pcmCore.AiInfo | |||||
| (*CloudInfo)(nil), // 2: pcmCore.CloudInfo | |||||
| (*HpcInfo)(nil), // 3: pcmCore.HpcInfo | |||||
| (*SyncInfoResp)(nil), // 4: pcmCore.SyncInfoResp | |||||
| (*InfoListReq)(nil), // 5: pcmCore.InfoListReq | |||||
| (*InfoListResp)(nil), // 6: pcmCore.InfoListResp | |||||
| } | } | ||||
| var file_pcmCore_proto_depIdxs = []int32{ | var file_pcmCore_proto_depIdxs = []int32{ | ||||
| 1, // 0: pcmCore.SyncInfoReq.latestExternalInfoList:type_name -> pcmCore.LatestExternalInfo | |||||
| 5, // 1: pcmCore.InfoListResp.externalInfoList:type_name -> pcmCore.ExternalInfo | |||||
| 0, // 2: pcmCore.pcmCore.SyncInfo:input_type -> pcmCore.SyncInfoReq | |||||
| 3, // 3: pcmCore.pcmCore.InfoList:input_type -> pcmCore.InfoListReq | |||||
| 2, // 4: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp | |||||
| 4, // 5: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp | |||||
| 4, // [4:6] is the sub-list for method output_type | |||||
| 2, // [2:4] is the sub-list for method input_type | |||||
| 2, // [2:2] is the sub-list for extension type_name | |||||
| 2, // [2:2] is the sub-list for extension extendee | |||||
| 0, // [0:2] is the sub-list for field type_name | |||||
| 3, // 0: pcmCore.SyncInfoReq.HpcInfoList:type_name -> pcmCore.HpcInfo | |||||
| 2, // 1: pcmCore.SyncInfoReq.CloudInfoList:type_name -> pcmCore.CloudInfo | |||||
| 1, // 2: pcmCore.SyncInfoReq.AiInfoList:type_name -> pcmCore.AiInfo | |||||
| 3, // 3: pcmCore.InfoListResp.HpcInfoList:type_name -> pcmCore.HpcInfo | |||||
| 2, // 4: pcmCore.InfoListResp.CloudInfoList:type_name -> pcmCore.CloudInfo | |||||
| 1, // 5: pcmCore.InfoListResp.AiInfoList:type_name -> pcmCore.AiInfo | |||||
| 0, // 6: pcmCore.pcmCore.SyncInfo:input_type -> pcmCore.SyncInfoReq | |||||
| 5, // 7: pcmCore.pcmCore.InfoList:input_type -> pcmCore.InfoListReq | |||||
| 4, // 8: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp | |||||
| 6, // 9: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp | |||||
| 8, // [8:10] is the sub-list for method output_type | |||||
| 6, // [6:8] is the sub-list for method input_type | |||||
| 6, // [6:6] is the sub-list for extension type_name | |||||
| 6, // [6:6] is the sub-list for extension extendee | |||||
| 0, // [0:6] is the sub-list for field type_name | |||||
| } | } | ||||
| func init() { file_pcmCore_proto_init() } | func init() { file_pcmCore_proto_init() } | ||||
| @@ -520,7 +781,7 @@ func file_pcmCore_proto_init() { | |||||
| } | } | ||||
| } | } | ||||
| file_pcmCore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | file_pcmCore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | ||||
| switch v := v.(*LatestExternalInfo); i { | |||||
| switch v := v.(*AiInfo); i { | |||||
| case 0: | case 0: | ||||
| return &v.state | return &v.state | ||||
| case 1: | case 1: | ||||
| @@ -532,7 +793,7 @@ func file_pcmCore_proto_init() { | |||||
| } | } | ||||
| } | } | ||||
| file_pcmCore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | file_pcmCore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | ||||
| switch v := v.(*SyncInfoResp); i { | |||||
| switch v := v.(*CloudInfo); i { | |||||
| case 0: | case 0: | ||||
| return &v.state | return &v.state | ||||
| case 1: | case 1: | ||||
| @@ -544,7 +805,7 @@ func file_pcmCore_proto_init() { | |||||
| } | } | ||||
| } | } | ||||
| file_pcmCore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | file_pcmCore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | ||||
| switch v := v.(*InfoListReq); i { | |||||
| switch v := v.(*HpcInfo); i { | |||||
| case 0: | case 0: | ||||
| return &v.state | return &v.state | ||||
| case 1: | case 1: | ||||
| @@ -556,7 +817,7 @@ func file_pcmCore_proto_init() { | |||||
| } | } | ||||
| } | } | ||||
| file_pcmCore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | file_pcmCore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | ||||
| switch v := v.(*InfoListResp); i { | |||||
| switch v := v.(*SyncInfoResp); i { | |||||
| case 0: | case 0: | ||||
| return &v.state | return &v.state | ||||
| case 1: | case 1: | ||||
| @@ -568,7 +829,19 @@ func file_pcmCore_proto_init() { | |||||
| } | } | ||||
| } | } | ||||
| file_pcmCore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { | file_pcmCore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { | ||||
| switch v := v.(*ExternalInfo); i { | |||||
| switch v := v.(*InfoListReq); i { | |||||
| case 0: | |||||
| return &v.state | |||||
| case 1: | |||||
| return &v.sizeCache | |||||
| case 2: | |||||
| return &v.unknownFields | |||||
| default: | |||||
| return nil | |||||
| } | |||||
| } | |||||
| file_pcmCore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { | |||||
| switch v := v.(*InfoListResp); i { | |||||
| case 0: | case 0: | ||||
| return &v.state | return &v.state | ||||
| case 1: | case 1: | ||||
| @@ -586,7 +859,7 @@ func file_pcmCore_proto_init() { | |||||
| GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||||
| RawDescriptor: file_pcmCore_proto_rawDesc, | RawDescriptor: file_pcmCore_proto_rawDesc, | ||||
| NumEnums: 0, | NumEnums: 0, | ||||
| NumMessages: 6, | |||||
| NumMessages: 7, | |||||
| NumExtensions: 0, | NumExtensions: 0, | ||||
| NumServices: 1, | NumServices: 1, | ||||
| }, | }, | ||||
| @@ -13,12 +13,13 @@ import ( | |||||
| ) | ) | ||||
| type ( | type ( | ||||
| ExternalInfo = pcmCore.ExternalInfo | |||||
| InfoListReq = pcmCore.InfoListReq | |||||
| InfoListResp = pcmCore.InfoListResp | |||||
| LatestExternalInfo = pcmCore.LatestExternalInfo | |||||
| SyncInfoReq = pcmCore.SyncInfoReq | |||||
| SyncInfoResp = pcmCore.SyncInfoResp | |||||
| AiInfo = pcmCore.AiInfo | |||||
| CloudInfo = pcmCore.CloudInfo | |||||
| HpcInfo = pcmCore.HpcInfo | |||||
| InfoListReq = pcmCore.InfoListReq | |||||
| InfoListResp = pcmCore.InfoListResp | |||||
| SyncInfoReq = pcmCore.SyncInfoReq | |||||
| SyncInfoResp = pcmCore.SyncInfoResp | |||||
| PcmCore interface { | PcmCore interface { | ||||
| // SyncInfo Synchronous data information | // SyncInfo Synchronous data information | ||||
| @@ -7,14 +7,11 @@ import ( | |||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/logic" | "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/logic" | ||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/server" | "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/server" | ||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/svc" | "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/svc" | ||||
| "PCM/common/param" | |||||
| "PCM/common/tool" | "PCM/common/tool" | ||||
| "context" | "context" | ||||
| "flag" | "flag" | ||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "github.com/zeromicro/go-zero/core/conf" | "github.com/zeromicro/go-zero/core/conf" | ||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "github.com/zeromicro/go-zero/core/service" | "github.com/zeromicro/go-zero/core/service" | ||||
| "github.com/zeromicro/go-zero/zrpc" | "github.com/zeromicro/go-zero/zrpc" | ||||
| "google.golang.org/grpc" | "google.golang.org/grpc" | ||||
| @@ -47,57 +44,91 @@ func main() { | |||||
| } | } | ||||
| func initCron(svc *svc.ServiceContext) { | func initCron(svc *svc.ServiceContext) { | ||||
| submitJobLogic := logic.NewSubmitJobLogic(context.Background(), svc) | |||||
| listLogic := logic.NewListJobLogic(context.Background(), svc) | |||||
| svc.Cron.AddFunc("*/5 * * * * ?", func() { | svc.Cron.AddFunc("*/5 * * * * ?", func() { | ||||
| SyncInfoReq := pcmcoreclient.SyncInfoReq{ | |||||
| Kind: "hpc", | |||||
| } | |||||
| // 查询core端分发下来的任务列表 | |||||
| infoReq := pcmcoreclient.InfoListReq{ | |||||
| syncInfoReq := pcmcoreclient.SyncInfoReq{ | |||||
| Kind: "hpc", | Kind: "hpc", | ||||
| ServiceName: "ac", | ServiceName: "ac", | ||||
| } | } | ||||
| infoList, err := svc.PcmCoreRpc.InfoList(context.Background(), &infoReq) | |||||
| // 查询core端分发下来的任务列表 | |||||
| infoList, err := queryCoreInfoList(svc) | |||||
| if err != nil { | if err != nil { | ||||
| logx.Error(err) | logx.Error(err) | ||||
| return | return | ||||
| } | } | ||||
| // 提交任务 | // 提交任务 | ||||
| go func() { | |||||
| submitJobLogic := logic.NewSubmitJobLogic(context.Background(), svc) | |||||
| for _, yamlString := range infoList.YamlString { | |||||
| bytes, err := json.Marshal(yamlString) | |||||
| if err != nil { | |||||
| return | |||||
| } | |||||
| var params param.HpcBase | |||||
| tool.Convert(bytes, ¶ms) | |||||
| submitReq := hpcAC.SubmitJobReq{} | |||||
| submitJobLogic.SubmitJob(&submitReq) | |||||
| } | |||||
| }() | |||||
| // 查询运行中的任务列表 | |||||
| listLogic := logic.NewListJobLogic(context.Background(), svc) | |||||
| submitJob(infoList, submitJobLogic) | |||||
| // 查询运行中的任务列表同步信息 | |||||
| listReq := hpcAC.ListJobReq{} | listReq := hpcAC.ListJobReq{} | ||||
| listJob, err := listLogic.ListJob(&listReq) | listJob, err := listLogic.ListJob(&listReq) | ||||
| if err != nil { | if err != nil { | ||||
| logx.Error(err) | |||||
| return | return | ||||
| } | } | ||||
| for _, taskInfo := range infoList.ExternalInfoList { | |||||
| for _, job := range listJob.Jobs { | |||||
| if job.JobId == taskInfo.ExternalField { | |||||
| external := pcmcoreclient.LatestExternalInfo{ | |||||
| ServiceName: "ac", | |||||
| TaskId: taskInfo.TaskId, | |||||
| ExternalField: taskInfo.ExternalField, | |||||
| Name: taskInfo.Name, | |||||
| StartTime: job.JobStartTime, | |||||
| RunningTime: int64(tool.StringToInt(job.JobRunTime)), | |||||
| for index1, _ := range infoList.HpcInfoList { | |||||
| for index2, _ := range listJob.Jobs { | |||||
| if listJob.Jobs[index2].JobName == infoList.HpcInfoList[index1].Name { | |||||
| infoList.HpcInfoList[index1].StartTime = listJob.Jobs[index2].JobStartTime | |||||
| infoList.HpcInfoList[index1].RunningTime = int64(tool.RunTimeToSeconds(listJob.Jobs[index2].JobRunTime)) | |||||
| if listJob.Jobs[index2].JobStatus == "statR" { | |||||
| infoList.HpcInfoList[index1].Status = "Running" | |||||
| } | |||||
| if listJob.Jobs[index2].JobStatus == "statC" { | |||||
| infoList.HpcInfoList[index1].Status = "Completed" | |||||
| } | } | ||||
| SyncInfoReq.LatestExternalInfoList = append(SyncInfoReq.LatestExternalInfoList, &external) | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // 同步信息到core端 | // 同步信息到core端 | ||||
| svc.PcmCoreRpc.SyncInfo(context.Background(), &SyncInfoReq) | |||||
| if len(infoList.HpcInfoList) != 0 { | |||||
| syncInfoReq.HpcInfoList = infoList.HpcInfoList | |||||
| svc.PcmCoreRpc.SyncInfo(context.Background(), &syncInfoReq) | |||||
| } | |||||
| }) | }) | ||||
| } | } | ||||
| func submitJob(infoList *pcmcoreclient.InfoListResp, submitJobLogic *logic.SubmitJobLogic) { | |||||
| for index, _ := range infoList.HpcInfoList { | |||||
| if infoList.HpcInfoList[index].Status == "Saved" { | |||||
| submitReq := hpcAC.SubmitJobReq{ | |||||
| Appname: "BASE", | |||||
| Apptype: "BASIC", | |||||
| StrJobManagerID: 1638523853, | |||||
| MapAppJobInfo: &hpcAC.MapAppJobInfo{ | |||||
| GAP_CMD_FILE: "sleep 10", | |||||
| GAP_NNODE: "1", | |||||
| GAP_SUBMIT_TYPE: "cmd", | |||||
| GAP_JOB_NAME: infoList.HpcInfoList[index].Name, | |||||
| GAP_WORK_DIR: infoList.HpcInfoList[index].WorkDir, | |||||
| GAP_QUEUE: "debug2", | |||||
| GAP_NPROC: "1", | |||||
| GAP_APPNAME: "BASE", | |||||
| GAP_WALL_TIME: infoList.HpcInfoList[index].WallTime, | |||||
| GAP_STD_OUT_FILE: "/public/home/zhijiang/test/testjob1/std.out.%j", | |||||
| GAP_STD_ERR_FILE: " /public/home/zhijiang/test/testjob1/std.err.%j", | |||||
| }, | |||||
| } | |||||
| jobResult, _ := submitJobLogic.SubmitJob(&submitReq) | |||||
| if jobResult.Code == "0" { | |||||
| infoList.HpcInfoList[index].Status = "Pending" | |||||
| infoList.HpcInfoList[index].JobId = jobResult.Data | |||||
| } else { | |||||
| infoList.HpcInfoList[index].Result = "Failed" | |||||
| infoList.HpcInfoList[index].Result = jobResult.Msg | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| func queryCoreInfoList(svc *svc.ServiceContext) (*pcmcoreclient.InfoListResp, error) { | |||||
| infoReq := pcmcoreclient.InfoListReq{ | |||||
| Kind: "hpc", | |||||
| ServiceName: "ac", | |||||
| } | |||||
| infoList, err := svc.PcmCoreRpc.InfoList(context.Background(), &infoReq) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return infoList, nil | |||||
| } | |||||
| @@ -55,7 +55,6 @@ func (l *SubmitJobLogic) SubmitJob(in *hpcAC.SubmitJobReq) (*hpcAC.SubmitJobResp | |||||
| //c := &http.Client{Timeout: 5 * time.Second} | //c := &http.Client{Timeout: 5 * time.Second} | ||||
| respUrl, err := c.Do(req_url) | respUrl, err := c.Do(req_url) | ||||
| defer respUrl.Body.Close() | |||||
| if err != nil { | if err != nil { | ||||
| return resp, err | return resp, err | ||||
| @@ -66,9 +66,9 @@ func initCron(svc *svc.ServiceContext) { | |||||
| // 提交任务 | // 提交任务 | ||||
| go func() { | go func() { | ||||
| applyYamlLogic := logic.NewApplyYamlLogic(context.Background(), svc) | applyYamlLogic := logic.NewApplyYamlLogic(context.Background(), svc) | ||||
| for _, yamlString := range infoList.YamlString { | |||||
| for _, cloudInfo := range infoList.CloudInfoList { | |||||
| applyReq := kubenativeclient.ApplyReq{ | applyReq := kubenativeclient.ApplyReq{ | ||||
| YamlString: yamlString, | |||||
| YamlString: cloudInfo.YamlString, | |||||
| } | } | ||||
| applyYamlLogic.ApplyYaml(&applyReq) | applyYamlLogic.ApplyYaml(&applyReq) | ||||
| } | } | ||||
| @@ -86,28 +86,20 @@ func initCron(svc *svc.ServiceContext) { | |||||
| } | } | ||||
| // 遍历core端任务列表信息 | // 遍历core端任务列表信息 | ||||
| for _, taskInfo := range infoList.ExternalInfoList { | |||||
| for _, cloudInfo := range infoList.CloudInfoList { | |||||
| for _, deployment := range deploymentList.Items { | for _, deployment := range deploymentList.Items { | ||||
| if deployment.Namespace == taskInfo.ExternalField && deployment.Name == taskInfo.Name { | |||||
| external := pcmcoreclient.LatestExternalInfo{ | |||||
| ServiceName: "kubeNative", | |||||
| TaskId: taskInfo.TaskId, | |||||
| ExternalField: taskInfo.ExternalField, | |||||
| Name: taskInfo.Name, | |||||
| StartTime: deployment.Status.Conditions[0].LastTransitionTime.Time.String(), | |||||
| RunningTime: time.Now().Sub(deployment.Status.Conditions[0].LastTransitionTime.Time).Milliseconds() / 1000, | |||||
| } | |||||
| if deployment.Namespace == cloudInfo.Namespace && deployment.Name == cloudInfo.Name { | |||||
| cloudInfo.StartTime = deployment.Status.Conditions[0].LastTransitionTime.Time.String() | |||||
| cloudInfo.RunningTime = time.Now().Sub(deployment.Status.Conditions[0].LastTransitionTime.Time).Milliseconds() / 1000 | |||||
| // 判断状态 | // 判断状态 | ||||
| if deployment.Status.ReadyReplicas == deployment.Status.Replicas { | if deployment.Status.ReadyReplicas == deployment.Status.Replicas { | ||||
| external.Status = "running" | |||||
| cloudInfo.Status = "running" | |||||
| } else { | } else { | ||||
| external.Status = "pending" | |||||
| cloudInfo.Status = "pending" | |||||
| } | } | ||||
| SyncInfoReq.LatestExternalInfoList = append(SyncInfoReq.LatestExternalInfoList, &external) | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| // 同步信息到core端 | // 同步信息到core端 | ||||
| svc.PcmCoreRpc.SyncInfo(context.Background(), &SyncInfoReq) | svc.PcmCoreRpc.SyncInfo(context.Background(), &SyncInfoReq) | ||||
| }) | }) | ||||
| @@ -1,7 +1,16 @@ | |||||
| package param | package param | ||||
| type HpcBase struct { | type HpcBase struct { | ||||
| JobId string `json:"jobId"` | |||||
| Name string `json:"name"` | |||||
| WorkDir string `json:"workDir"` | |||||
| TaskId int64 `json:"taskId" db:"task_id"` | |||||
| ServiceName string `json:"serviceName" db:"service_name"` | |||||
| JobId string `json:"jobId" db:"job_id"` | |||||
| Name string `json:"name" db:"name"` | |||||
| WorkDir string `json:"workDir" db:"work_dir"` | |||||
| WallTime string `json:"wallTime" db:"wall_time"` | |||||
| Status string `json:"status" db:"status"` | |||||
| Result string `json:"result" db:"result"` | |||||
| YamlString string `json:"yamlString" db:"yaml_string"` | |||||
| } | |||||
| type AiBase struct { | |||||
| } | } | ||||