|
- package models
-
- import (
- "strconv"
- "time"
- )
-
- func GenerateDebugOneCount(beginTime time.Time, endTime time.Time) (int64, error) {
- countSql := "SELECT count(*) FROM " +
- "public.cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) +
- " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) +
- " and job_type=" + "DEBUG"
-
- return xStatistic.SQL(countSql).Count()
- }
-
- func GenerateBenchmarkOneCount(beginTime time.Time, endTime time.Time) (int64, error) {
- countSql := "SELECT count(*) FROM " +
- "SELECT job_id FROM cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) +
- " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) +
- " and job_type=" + "BENCHMARK" +
- " and type=" + "0"
- return xStatistic.SQL(countSql).Count()
- }
- func GenerateDebugTwoCount(beginTime time.Time, endTime time.Time) (int64, error) {
- countSql := "SELECT count(*) FROM " +
- "SELECT job_id FROM cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) +
- " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) +
- " and job_type=" + "DEBUG" +
- " and type=" + "2"
- return xStatistic.SQL(countSql).Count()
- }
- func GenerateTrainTwoCount(beginTime time.Time, endTime time.Time) (int64, error) {
- countSql := "SELECT count(*) FROM " +
- "SELECT job_id FROM cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) +
- " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) +
- " and job_type=" + "TRAIN" +
- " and type=" + "1"
- return xStatistic.SQL(countSql).Count()
- }
- func GenerateInferenceTwoCount(beginTime time.Time, endTime time.Time) (int64, error) {
- countSql := "SELECT count(*) FROM " +
- "SELECT job_id FROM cloudbrain where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) +
- " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) +
- " and job_type=" + "INFERENCE" +
- " and type=" + "1"
- return xStatistic.SQL(countSql).Count()
- }
|