forked from JointCloud/pcm-coordinator
parent
f5e737696b
commit
421afa3839
|
@ -156,22 +156,20 @@ type AiInfo struct {
|
|||
}
|
||||
|
||||
type VmInfo struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
TaskId int64 `json:"taskId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
AdapterId int64 `json:"adapterId,omitempty,optional"`
|
||||
AdapterName string `json:"adapterName,omitempty,optional"`
|
||||
ClusterId int64 `json:"clusterId,omitempty,optional"`
|
||||
ClusterName string `json:"clusterName,omitempty,optional"`
|
||||
FlavorRef string `json:"flavorRef,omitempty"`
|
||||
ImageRef string `json:"imageRef,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
Description string `json:"description,omitempty"` // 描述
|
||||
AvailabilityZone string `json:"availabilityZone,omitempty"`
|
||||
MinCount int64 `json:"minCount,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
Id int64 `json:"id,omitempty"`
|
||||
TaskId int64 `json:"taskId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
AdapterId int64 `json:"adapterId,omitempty,optional"`
|
||||
AdapterName string `json:"adapterName,omitempty,optional"`
|
||||
ClusterId int64 `json:"clusterId,omitempty,optional"`
|
||||
ClusterName string `json:"clusterName,omitempty,optional"`
|
||||
FlavorRef string `json:"flavorRef,omitempty"`
|
||||
ImageRef string `json:"imageRef,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
MinCount int64 `json:"minCount,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
//RunningTime string `json:"runningTime,omitempty"`
|
||||
//Result string `json:"result,omitempty"`
|
||||
//DeletedAt string `json:"deletedAt,omitempty"`
|
||||
|
|
|
@ -5,8 +5,8 @@ Port: 8999
|
|||
Timeout: 50000
|
||||
|
||||
DB:
|
||||
DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
|
||||
# DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local
|
||||
#DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local
|
||||
DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local
|
||||
Redis:
|
||||
Host: 10.206.0.12:6379
|
||||
Pass: redisPW123
|
||||
|
|
|
@ -108,7 +108,7 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie
|
|||
func syncTask(gorm *gorm.DB, noticeInfo clientCore.NoticeInfo) {
|
||||
|
||||
var allStatus string
|
||||
tx := gorm.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status))as status from task t left join task_hpc h on t.id = h.task_id left join task_cloud c on t.id = c.task_id left join task_ai a on t.id = a.task_id where t.id = ?", noticeInfo.TaskId).Scan(&allStatus)
|
||||
tx := gorm.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status))as status from task t left join task_hpc h on t.id = h.task_id left join task_cloud c on t.id = c.task_id left join task_vm v on t.id = v.task_id left join task_ai a on t.id = a.task_id where t.id = ?", noticeInfo.TaskId).Scan(&allStatus)
|
||||
if tx.Error != nil {
|
||||
logx.Error(tx.Error)
|
||||
}
|
||||
|
|
|
@ -35,28 +35,26 @@ type (
|
|||
}
|
||||
|
||||
TaskVm struct {
|
||||
Id int64 `db:"id"` // id
|
||||
TaskId int64 `db:"task_id"` // 任务id
|
||||
Name string `db:"name"` // 任务名称
|
||||
AdapterId int64 `db:"adapter_id"` // 执行任务的适配器id
|
||||
AdapterName string `db:"adapter_name"` // 适配器名称
|
||||
ClusterId int64 `db:"cluster_id"` // 执行任务的集群id
|
||||
ClusterName string `db:"cluster_name"` // 集群名称
|
||||
FlavorRef string `db:"flavor_ref"` // 规格索引
|
||||
ImageRef string `db:"image_ref"` // 镜像索引
|
||||
Status string `db:"status"` // 状态
|
||||
Platform string `db:"platform"` // 平台
|
||||
Description string `db:"description"` // 描述
|
||||
AvailabilityZone string `db:"availability_zone"`
|
||||
MinCount int64 `db:"min_count"` // 数量
|
||||
Uuid string `db:"uuid"` // 网络id
|
||||
StartTime string `db:"start_time"` // 开始时间
|
||||
RunningTime string `db:"running_time"` // 运行时间
|
||||
Result string `db:"result"` // 运行结果
|
||||
Remark string `db:"remark"` // 备注
|
||||
DeletedAt string `db:"deleted_at"` // 删除时间
|
||||
VmName string `db:"vm_name"` // 虚拟机名称
|
||||
Replicas int64 `db:"replicas"` // 副本数
|
||||
Id int64 `db:"id"` // id
|
||||
TaskId int64 `db:"task_id"` // 任务id
|
||||
Name string `db:"name"` // 任务名称
|
||||
AdapterId int64 `db:"adapter_id"` // 执行任务的适配器id
|
||||
AdapterName string `db:"adapter_name"` // 适配器名称
|
||||
ClusterId int64 `db:"cluster_id"` // 执行任务的集群id
|
||||
ClusterName string `db:"cluster_name"` // 集群名称
|
||||
FlavorRef string `db:"flavor_ref"` // 规格索引
|
||||
ImageRef string `db:"image_ref"` // 镜像索引
|
||||
Status string `db:"status"` // 状态
|
||||
Platform string `db:"platform"` // 平台
|
||||
MinCount int64 `db:"min_count"` // 数量
|
||||
Uuid string `db:"uuid"` // 网络id
|
||||
StartTime string `db:"start_time"` // 开始时间
|
||||
RunningTime string `db:"running_time"` // 运行时间
|
||||
Result string `db:"result"` // 运行结果
|
||||
Remark string `db:"remark"` // 备注
|
||||
DeletedAt string `db:"deleted_at"` // 删除时间
|
||||
VmName string `db:"vm_name"` // 虚拟机名称
|
||||
Replicas int64 `db:"replicas"` // 副本数
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -96,13 +94,13 @@ func (m *defaultTaskVmModel) FindOne(ctx context.Context, id int64) (*TaskVm, er
|
|||
|
||||
func (m *defaultTaskVmModel) Insert(ctx context.Context, data *TaskVm) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskVmRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.Name, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.FlavorRef, data.ImageRef, data.Status, data.Platform, data.Description, data.AvailabilityZone, data.MinCount, data.Uuid, data.StartTime, data.RunningTime, data.Result, data.Remark, data.DeletedAt, data.VmName, data.Replicas)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.Name, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.FlavorRef, data.ImageRef, data.Status, data.Platform, data.MinCount, data.Uuid, data.StartTime, data.RunningTime, data.Result, data.Remark, data.DeletedAt, data.VmName, data.Replicas)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultTaskVmModel) Update(ctx context.Context, data *TaskVm) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskVmRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.Name, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.FlavorRef, data.ImageRef, data.Status, data.Platform, data.Description, data.AvailabilityZone, data.MinCount, data.Uuid, data.StartTime, data.RunningTime, data.Result, data.Remark, data.DeletedAt, data.VmName, data.Replicas, data.Id)
|
||||
_, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.Name, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.FlavorRef, data.ImageRef, data.Status, data.Platform, data.MinCount, data.Uuid, data.StartTime, data.RunningTime, data.Result, data.Remark, data.DeletedAt, data.VmName, data.Replicas, data.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue