|
|
|
@@ -28,15 +28,17 @@ type CloudbrainsPeriodData struct { |
|
|
|
CloudBrainTwoPeriodCount int64 `json:"cloudBrainTwoPeriodCount"` |
|
|
|
} |
|
|
|
type CloudbrainsOverviewData struct { |
|
|
|
JobWaitingCount int64 `json:"jobWaitingCount"` |
|
|
|
JobRunningCount int64 `json:"jobRunningCount"` |
|
|
|
JobStoppedCount int64 `json:"jobStoppedCount"` |
|
|
|
JobSucceededCount int64 `json:"jobSucceededCount"` |
|
|
|
JobFailedCount int64 `json:"jobFailedCount"` |
|
|
|
CloudBrainOneCount int64 `json:"cloudBrainOneCount"` |
|
|
|
CloudBrainTwoCount int64 `json:"cloudBrainTwoCount"` |
|
|
|
CloudBrainOneDuration int64 `json:"cloudBrainOneDuration"` |
|
|
|
CloudBrainTwoDuration int64 `json:"cloudBrainTwoDuration"` |
|
|
|
JobWaitingPeriodCount int64 `json:"jobWaitingPeriodCount"` |
|
|
|
JobRunningPeriodCount int64 `json:"jobRunningPeriodCount"` |
|
|
|
JobStoppedPeriodCount int64 `json:"jobStoppedPeriodCount"` |
|
|
|
JobSucceededPeriodCount int64 `json:"jobSucceededPeriodCount"` |
|
|
|
JobFailedPeriodCount int64 `json:"jobFailedPeriodCount"` |
|
|
|
CloudBrainOneCount int64 `json:"cloudBrainOneCount"` |
|
|
|
CloudBrainTwoCount int64 `json:"cloudBrainTwoCount"` |
|
|
|
CloudBrainOneDuration int64 `json:"cloudBrainOneDuration"` |
|
|
|
CloudBrainTwoDuration int64 `json:"cloudBrainTwoDuration"` |
|
|
|
CreatorPeriodCount int64 `json:"creatorPeriodCount"` |
|
|
|
CreatorCount int64 `json:"creatorCount"` |
|
|
|
} |
|
|
|
type TimeCloudbrainsNum struct { |
|
|
|
TimeCloudbrainNum []DateCloudbrainNum `json:"dateCloudbrainNum"` |
|
|
|
@@ -62,27 +64,27 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { |
|
|
|
log.Info("beginTime:", beginTime) |
|
|
|
endTime := now |
|
|
|
log.Info("endTime:", endTime) |
|
|
|
jobWaitingCount, err := models.GetJobWaitingCount(beginTime, endTime) |
|
|
|
jobWaitingPeriodCount, err := models.GetJobWaitingPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query jobWaitingCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
jobRunningCount, err := models.GetJobRunningCount(beginTime, endTime) |
|
|
|
jobRunningPeriodCount, err := models.GetJobRunningPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query jobRunningCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
jobStoppedCount, err := models.GetJobStoppedCount(beginTime, endTime) |
|
|
|
jobStoppedPeriodCount, err := models.GetJobStoppedPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query jobStoppedCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
jobSucceededCount, err := models.GetJobSucceededCount(beginTime, endTime) |
|
|
|
jobSucceededPeriodCount, err := models.GetJobSucceededPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query jobSucceededCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
jobFailedCount, err := models.GetJobFailedCount(beginTime, endTime) |
|
|
|
jobFailedPeriodCount, err := models.GetJobFailedPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query jobFailedCount.", err) |
|
|
|
return |
|
|
|
@@ -107,17 +109,29 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { |
|
|
|
log.Error("Can not query cloudBrainTwoDuration.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
creatorPeriodCount, err := models.GetCreatorPeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query creatorPeriodCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
creatorCount, err := models.GetCreatorCount() |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query creatorCount.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
CloudbrainsOverviewData := CloudbrainsOverviewData{ |
|
|
|
JobWaitingCount: jobWaitingCount, |
|
|
|
JobRunningCount: jobRunningCount, |
|
|
|
JobStoppedCount: jobStoppedCount, |
|
|
|
JobSucceededCount: jobSucceededCount, |
|
|
|
JobFailedCount: jobFailedCount, |
|
|
|
CloudBrainOneCount: cloudBrainOneCount, |
|
|
|
CloudBrainTwoCount: cloudBrainTwoCount, |
|
|
|
CloudBrainOneDuration: cloudBrainOneDuration, |
|
|
|
CloudBrainTwoDuration: cloudBrainTwoDuration, |
|
|
|
JobWaitingPeriodCount: jobWaitingPeriodCount, |
|
|
|
JobRunningPeriodCount: jobRunningPeriodCount, |
|
|
|
JobStoppedPeriodCount: jobStoppedPeriodCount, |
|
|
|
JobSucceededPeriodCount: jobSucceededPeriodCount, |
|
|
|
JobFailedPeriodCount: jobFailedPeriodCount, |
|
|
|
CloudBrainOneCount: cloudBrainOneCount, |
|
|
|
CloudBrainTwoCount: cloudBrainTwoCount, |
|
|
|
CloudBrainOneDuration: cloudBrainOneDuration, |
|
|
|
CloudBrainTwoDuration: cloudBrainTwoDuration, |
|
|
|
CreatorPeriodCount: creatorPeriodCount, |
|
|
|
CreatorCount: creatorCount, |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, CloudbrainsOverviewData) |
|
|
|
@@ -355,6 +369,10 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
ctx.JSON(http.StatusOK, cloudbrainsPeriodData) |
|
|
|
} |
|
|
|
|
|
|
|
func GetCloudbrainsStatusAnalysis(ctx *context.Context) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func getCloudbrainCount(beginTime time.Time, endTime time.Time) (int64, int64, int64, int64, int64, int64, int64, int64, int64, error) { |
|
|
|
debugOneCount, err := models.GetDebugOnePeriodCount(beginTime, endTime) |
|
|
|
if err != nil { |
|
|
|
|