任务列表修改
Former-commit-id: 653b972fac7e26ba710770419b13ee883257e313
This commit is contained in:
parent
b33442951d
commit
531406600d
|
@ -28,18 +28,16 @@ func NewTaskListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TaskList
|
||||||
|
|
||||||
func (l *TaskListLogic) TaskList() (resp *types.TaskListResp, err error) {
|
func (l *TaskListLogic) TaskList() (resp *types.TaskListResp, err error) {
|
||||||
resp = &types.TaskListResp{}
|
resp = &types.TaskListResp{}
|
||||||
// 查询总运行时长
|
|
||||||
tx := l.svcCtx.DbEngin.Raw("select sum(running_time)/3600 as total_run_time from (select sum(running_time) as running_time from hpc union all select sum(running_time) as running_time from cloud union all select sum(running_time) as running_time from ai) runtime").Scan(&resp.TotalRunTime)
|
// 查询任务数据
|
||||||
|
var tasks []model.Task
|
||||||
|
tx := l.svcCtx.DbEngin.Find(&tasks)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return nil, tx.Error
|
return nil, tx.Error
|
||||||
}
|
}
|
||||||
// 查询任务数据
|
if len(tasks) == 0 {
|
||||||
var tasks []model.Task
|
return nil, nil
|
||||||
tx = l.svcCtx.DbEngin.Find(&tasks)
|
|
||||||
if tx.Error != nil {
|
|
||||||
logx.Error(err)
|
|
||||||
return nil, tx.Error
|
|
||||||
}
|
}
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
tx := l.svcCtx.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.service_name) ,GROUP_CONCAT(DISTINCT a.service_name) ,GROUP_CONCAT(DISTINCT c.service_name))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&task.ServiceName)
|
tx := l.svcCtx.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.service_name) ,GROUP_CONCAT(DISTINCT a.service_name) ,GROUP_CONCAT(DISTINCT c.service_name))as service_name from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&task.ServiceName)
|
||||||
|
@ -65,6 +63,12 @@ func (l *TaskListLogic) TaskList() (resp *types.TaskListResp, err error) {
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 查询总运行时长
|
||||||
|
tx = l.svcCtx.DbEngin.Raw("select sum(running_time)/3600 as total_run_time from (select sum(running_time) as running_time from hpc union all select sum(running_time) as running_time from cloud union all select sum(running_time) as running_time from ai) runtime").Scan(&resp.TotalRunTime)
|
||||||
|
if tx.Error != nil {
|
||||||
|
logx.Error(err)
|
||||||
|
return nil, tx.Error
|
||||||
|
}
|
||||||
// 运行卡时数
|
// 运行卡时数
|
||||||
tx = l.svcCtx.DbEngin.Model(&model.Hpc{}).Select("(CASE WHEN SUM(running_time * card_count)/3600 IS NULL THEN 0 ELSE SUM(running_time * card_count)/3600 END )as cardTime").Find(&resp.CardTime)
|
tx = l.svcCtx.DbEngin.Model(&model.Hpc{}).Select("(CASE WHEN SUM(running_time * card_count)/3600 IS NULL THEN 0 ELSE SUM(running_time * card_count)/3600 END )as cardTime").Find(&resp.CardTime)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
|
|
|
@ -7,7 +7,7 @@ NacosConfig:
|
||||||
- IpAddr: 10.101.15.7
|
- IpAddr: 10.101.15.7
|
||||||
Port: 8848
|
Port: 8848
|
||||||
ClientConfig:
|
ClientConfig:
|
||||||
NamespaceId: test
|
NamespaceId: zhangwei
|
||||||
TimeoutMs: 5000
|
TimeoutMs: 5000
|
||||||
NotLoadCacheAtStart: true
|
NotLoadCacheAtStart: true
|
||||||
LogDir:
|
LogDir:
|
||||||
|
|
Loading…
Reference in New Issue