|
|
|
@@ -903,6 +903,52 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { |
|
|
|
return cloudbrains, count, nil |
|
|
|
} |
|
|
|
|
|
|
|
func QueryModelTrainJobVersionList(jobId string) ([]*CloudbrainInfo, int, error) { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
|
|
|
|
var cond = builder.NewCond() |
|
|
|
|
|
|
|
cond = cond.And( |
|
|
|
builder.Eq{"cloudbrain.job_id": jobId}, |
|
|
|
) |
|
|
|
cond = cond.And( |
|
|
|
builder.Eq{"cloudbrain.Status": "COMPLETED"}, |
|
|
|
) |
|
|
|
|
|
|
|
sess.OrderBy("cloudbrain.created_unix DESC") |
|
|
|
cloudbrains := make([]*CloudbrainInfo, 0) |
|
|
|
if err := sess.Table(&Cloudbrain{}).Where(cond). |
|
|
|
Find(&cloudbrains); err != nil { |
|
|
|
return nil, 0, fmt.Errorf("Find: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
return cloudbrains, int(len(cloudbrains)), nil |
|
|
|
} |
|
|
|
|
|
|
|
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}, |
|
|
|
) |
|
|
|
cond = cond.And( |
|
|
|
builder.Eq{"cloudbrain.Status": "COMPLETED"}, |
|
|
|
) |
|
|
|
|
|
|
|
sess.OrderBy("cloudbrain.created_unix DESC") |
|
|
|
cloudbrains := make([]*CloudbrainInfo, 0) |
|
|
|
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 |
|
|
|
} |
|
|
|
|
|
|
|
func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int, error) { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
|