|
|
@@ -52,6 +52,8 @@ const ( |
|
|
|
JobFailed CloudbrainStatus = "FAILED" |
|
|
|
JobRunning CloudbrainStatus = "RUNNING" |
|
|
|
|
|
|
|
ModelSafetyTesting CloudbrainStatus = "TESTING" |
|
|
|
|
|
|
|
JobTypeDebug JobType = "DEBUG" |
|
|
|
JobTypeBenchmark JobType = "BENCHMARK" |
|
|
|
JobTypeModelSafety JobType = "MODELSAFETY" |
|
|
@@ -1935,6 +1937,13 @@ func GetStoppedJobWithNoStartTimeEndTime() ([]*Cloudbrain, error) { |
|
|
|
return cloudbrains, x.SQL("select * from cloudbrain where status in (?,?,?,?,?,?,?) and (start_time is null or end_time is null) limit 100", ModelArtsTrainJobCompleted, ModelArtsTrainJobFailed, ModelArtsTrainJobKilled, ModelArtsStopped, JobStopped, JobFailed, JobSucceeded).Find(&cloudbrains) |
|
|
|
} |
|
|
|
|
|
|
|
func GetRunningModelSafetyTestTask() ([]*Cloudbrain, error) { |
|
|
|
cloudbrains := make([]*Cloudbrain, 0) |
|
|
|
sess := x.Where("job_type = ? and status=?", string(JobTypeModelSafety), JobRunning) |
|
|
|
err := sess.Find(&cloudbrains) |
|
|
|
return cloudbrains, err |
|
|
|
} |
|
|
|
|
|
|
|
func GetCloudbrainCountByUserID(userID int64, jobType string) (int, error) { |
|
|
|
count, err := x.In("status", JobWaiting, JobRunning).And("job_type = ? and user_id = ? and type = ?", jobType, userID, TypeCloudBrainOne).Count(new(Cloudbrain)) |
|
|
|
return int(count), err |
|
|
|