|
|
@@ -929,23 +929,19 @@ func QueryModelTrainJobVersionList(jobId string) ([]*CloudbrainInfo, int, error) |
|
|
|
func QueryModelTrainJobList(repoId int64) ([]*CloudbrainInfo, int, error) { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
|
|
|
|
var cond = builder.NewCond() |
|
|
|
|
|
|
|
cond = cond.And( |
|
|
|
builder.Eq{"cloudbrain.repo_id": repoId}, |
|
|
|
builder.Eq{"repo_id": repoId}, |
|
|
|
) |
|
|
|
cond = cond.And( |
|
|
|
builder.Eq{"cloudbrain.Status": "COMPLETED"}, |
|
|
|
builder.Eq{"Status": "COMPLETED"}, |
|
|
|
) |
|
|
|
|
|
|
|
sess.OrderBy("cloudbrain.created_unix DESC") |
|
|
|
sess.OrderBy("job_id DESC") |
|
|
|
cloudbrains := make([]*CloudbrainInfo, 0) |
|
|
|
if err := sess.Select("DISTINCT job_id,created_unix").Table(&Cloudbrain{}).Where(cond). |
|
|
|
if err := sess.Distinct("job_id").Table(&Cloudbrain{}).Where(cond). |
|
|
|
Find(&cloudbrains); err != nil { |
|
|
|
return nil, 0, fmt.Errorf("Find: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
return cloudbrains, int(len(cloudbrains)), nil |
|
|
|
} |
|
|
|
|
|
|
|