cc-backend/graph/model/models_gen.go

275 lines
6.0 KiB
Go
Raw Normal View History

2021-03-31 08:50:53 +02:00
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
"time"
2021-10-26 10:22:02 +02:00
"github.com/ClusterCockpit/cc-jobarchive/schema"
2021-03-31 08:50:53 +02:00
)
type FilterRanges struct {
Duration *IntRangeOutput `json:"duration"`
NumNodes *IntRangeOutput `json:"numNodes"`
StartTime *TimeRangeOutput `json:"startTime"`
2021-03-31 08:50:53 +02:00
}
type FloatRange struct {
From float64 `json:"from"`
To float64 `json:"to"`
}
type HistoPoint struct {
Count int `json:"count"`
Value int `json:"value"`
}
type IntRange struct {
From int `json:"from"`
To int `json:"to"`
}
type IntRangeOutput struct {
From int `json:"from"`
To int `json:"to"`
}
2021-10-26 10:22:02 +02:00
type Job struct {
ID string `json:"id"`
JobID string `json:"jobId"`
UserID string `json:"userId"`
ProjectID string `json:"projectId"`
ClusterID string `json:"clusterId"`
StartTime time.Time `json:"startTime"`
Duration int `json:"duration"`
NumNodes int `json:"numNodes"`
Nodes []string `json:"nodes"`
HasProfile bool `json:"hasProfile"`
State JobState `json:"state"`
Tags []*JobTag `json:"tags"`
LoadAvg *float64 `json:"loadAvg"`
MemUsedMax *float64 `json:"memUsedMax"`
FlopsAnyAvg *float64 `json:"flopsAnyAvg"`
MemBwAvg *float64 `json:"memBwAvg"`
NetBwAvg *float64 `json:"netBwAvg"`
FileBwAvg *float64 `json:"fileBwAvg"`
}
2021-03-31 08:50:53 +02:00
type JobFilter struct {
Tags []string `json:"tags"`
JobID *StringInput `json:"jobId"`
UserID *StringInput `json:"userId"`
ProjectID *StringInput `json:"projectId"`
ClusterID *StringInput `json:"clusterId"`
Duration *IntRange `json:"duration"`
NumNodes *IntRange `json:"numNodes"`
StartTime *TimeRange `json:"startTime"`
2021-09-23 11:45:20 +02:00
IsRunning *bool `json:"isRunning"`
FlopsAnyAvg *FloatRange `json:"flopsAnyAvg"`
MemBwAvg *FloatRange `json:"memBwAvg"`
LoadAvg *FloatRange `json:"loadAvg"`
MemUsedMax *FloatRange `json:"memUsedMax"`
2021-03-31 08:50:53 +02:00
}
2021-04-07 09:19:21 +02:00
type JobMetricWithName struct {
2021-10-26 10:22:02 +02:00
Name string `json:"name"`
Metric *schema.JobMetric `json:"metric"`
2021-04-07 09:19:21 +02:00
}
2021-03-31 08:50:53 +02:00
type JobResultList struct {
Items []*Job `json:"items"`
Offset *int `json:"offset"`
Limit *int `json:"limit"`
Count *int `json:"count"`
}
type JobsStatistics struct {
2021-10-26 10:22:02 +02:00
ID string `json:"id"`
2021-03-31 08:50:53 +02:00
TotalJobs int `json:"totalJobs"`
ShortJobs int `json:"shortJobs"`
TotalWalltime int `json:"totalWalltime"`
TotalCoreHours int `json:"totalCoreHours"`
HistWalltime []*HistoPoint `json:"histWalltime"`
HistNumNodes []*HistoPoint `json:"histNumNodes"`
}
2021-04-22 15:00:54 +02:00
type MetricConfig struct {
Name string `json:"name"`
Unit string `json:"unit"`
Sampletime int `json:"sampletime"`
Peak int `json:"peak"`
Normal int `json:"normal"`
Caution int `json:"caution"`
Alert int `json:"alert"`
}
2021-10-26 10:22:02 +02:00
type MetricFootprints struct {
Name string `json:"name"`
Footprints []schema.Float `json:"footprints"`
}
2021-12-09 16:25:48 +01:00
type NodeMetric struct {
Name string `json:"name"`
Data []schema.Float `json:"data"`
}
type NodeMetrics struct {
ID string `json:"id"`
Metrics []*NodeMetric `json:"metrics"`
}
2021-03-31 08:50:53 +02:00
type OrderByInput struct {
2021-10-26 10:22:02 +02:00
Field string `json:"field"`
Order SortDirectionEnum `json:"order"`
2021-03-31 08:50:53 +02:00
}
type PageRequest struct {
2021-09-23 11:45:20 +02:00
ItemsPerPage int `json:"itemsPerPage"`
Page int `json:"page"`
2021-03-31 08:50:53 +02:00
}
type StringInput struct {
Eq *string `json:"eq"`
Contains *string `json:"contains"`
StartsWith *string `json:"startsWith"`
EndsWith *string `json:"endsWith"`
}
type TimeRange struct {
2021-10-26 10:22:02 +02:00
From *time.Time `json:"from"`
To *time.Time `json:"to"`
2021-03-31 08:50:53 +02:00
}
type TimeRangeOutput struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
}
2021-10-26 10:22:02 +02:00
type Aggregate string
const (
AggregateUser Aggregate = "USER"
AggregateProject Aggregate = "PROJECT"
AggregateCluster Aggregate = "CLUSTER"
)
var AllAggregate = []Aggregate{
AggregateUser,
AggregateProject,
AggregateCluster,
}
func (e Aggregate) IsValid() bool {
switch e {
case AggregateUser, AggregateProject, AggregateCluster:
return true
}
return false
}
func (e Aggregate) String() string {
return string(e)
}
func (e *Aggregate) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Aggregate(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Aggregate", str)
}
return nil
}
func (e Aggregate) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
2021-09-23 11:45:20 +02:00
}
2021-10-26 10:22:02 +02:00
type JobState string
2021-04-07 09:19:21 +02:00
const (
2021-10-26 10:22:02 +02:00
JobStateRunning JobState = "running"
JobStateCompleted JobState = "completed"
2021-04-07 09:19:21 +02:00
)
2021-10-26 10:22:02 +02:00
var AllJobState = []JobState{
JobStateRunning,
JobStateCompleted,
2021-04-07 09:19:21 +02:00
}
2021-10-26 10:22:02 +02:00
func (e JobState) IsValid() bool {
2021-04-07 09:19:21 +02:00
switch e {
2021-10-26 10:22:02 +02:00
case JobStateRunning, JobStateCompleted:
2021-04-07 09:19:21 +02:00
return true
}
return false
}
2021-10-26 10:22:02 +02:00
func (e JobState) String() string {
2021-04-07 09:19:21 +02:00
return string(e)
}
2021-10-26 10:22:02 +02:00
func (e *JobState) UnmarshalGQL(v interface{}) error {
2021-04-07 09:19:21 +02:00
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
2021-10-26 10:22:02 +02:00
*e = JobState(str)
2021-04-07 09:19:21 +02:00
if !e.IsValid() {
2021-10-26 10:22:02 +02:00
return fmt.Errorf("%s is not a valid JobState", str)
2021-04-07 09:19:21 +02:00
}
return nil
}
2021-10-26 10:22:02 +02:00
func (e JobState) MarshalGQL(w io.Writer) {
2021-04-07 09:19:21 +02:00
fmt.Fprint(w, strconv.Quote(e.String()))
}
2021-03-31 08:50:53 +02:00
type SortDirectionEnum string
const (
SortDirectionEnumDesc SortDirectionEnum = "DESC"
SortDirectionEnumAsc SortDirectionEnum = "ASC"
)
var AllSortDirectionEnum = []SortDirectionEnum{
SortDirectionEnumDesc,
SortDirectionEnumAsc,
}
func (e SortDirectionEnum) IsValid() bool {
switch e {
case SortDirectionEnumDesc, SortDirectionEnumAsc:
return true
}
return false
}
func (e SortDirectionEnum) String() string {
return string(e)
}
func (e *SortDirectionEnum) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = SortDirectionEnum(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid SortDirectionEnum", str)
}
return nil
}
func (e SortDirectionEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}