Change cluster.json to camelCase, go fmt

This commit is contained in:
Lou Knauer 2021-05-12 18:34:55 +02:00
parent 030f1a3fba
commit 2605623324
4 changed files with 25 additions and 25 deletions

View File

@ -1,10 +1,10 @@
# Run server
* The server expects the SQLite Job database in `./job.db`.
* The metric data as JSON is expected in `./job-data/.../.../data.json`.
* A JSON-description of the clusters is expected in `./clusters/*.json`.
* Run ```go run server.go```
* The GraphQL backend is located at http://localhost:8080/query/ .
* The metric data as JSON is expected in `./job-data/<clusterId>/.../data.json`.
* A JSON-description of the clusters is expected in `./job-data/<clusterId>/cluster.json`.
* Run `go run server.go`
* The GraphQL backend is located at http://localhost:8080/query .
# Debugging and Testing

View File

@ -33,13 +33,13 @@ type JobTag struct {
}
type Cluster struct {
ClusterID string `json:"cluster_id"`
ProcessorType string `json:"processor_type"`
SocketsPerNode int `json:"sockets_per_node"`
CoresPerSocket int `json:"cores_per_socket"`
ThreadsPerCore int `json:"threads_per_core"`
FlopRateScalar int `json:"flop_rate_scalar"`
FlopRateSimd int `json:"flop_rate_simd"`
MemoryBandwidth int `json:"memory_bandwidth"`
MetricConfig []MetricConfig `json:"metric_config"`
ClusterID string `json:"clusterID"`
ProcessorType string `json:"processorType"`
SocketsPerNode int `json:"socketsPerNode"`
CoresPerSocket int `json:"coresPerSocket"`
ThreadsPerCore int `json:"threadsPerCore"`
FlopRateScalar int `json:"flopRateScalar"`
FlopRateSimd int `json:"flopRateSimd"`
MemoryBandwidth int `json:"memoryBandwidth"`
MetricConfig []MetricConfig `json:"metricConfig"`
}

View File

@ -63,7 +63,7 @@ func addTimeCondition(conditions []string, field string, input *model.TimeRange)
func addFloatCondition(conditions []string, field string, input *model.FloatRange) []string {
conditions = append(conditions, fmt.Sprintf("%s BETWEEN %f AND %f", field, input.From, input.To))
return conditions;
return conditions
}
func buildQueryConditions(filterList *model.JobFilterList) (string, string) {
@ -410,8 +410,8 @@ func (r *queryResolver) FilterRanges(
panic("expected exactly one row")
}
duration := &model.IntRangeOutput{};
numNodes := &model.IntRangeOutput{};
duration := &model.IntRangeOutput{}
numNodes := &model.IntRangeOutput{}
var startTimeMin, startTimeMax int64
err = rows.Scan(&duration.From, &duration.To,
@ -421,9 +421,9 @@ func (r *queryResolver) FilterRanges(
return nil, err
}
startTime := &model.TimeRangeOutput {
time.Unix(startTimeMin, 0), time.Unix(startTimeMax, 0) }
return &model.FilterRanges{ duration, numNodes, startTime }, nil
startTime := &model.TimeRangeOutput{
time.Unix(startTimeMin, 0), time.Unix(startTimeMax, 0)}
return &model.FilterRanges{duration, numNodes, startTime}, nil
}
func (r *jobResolver) Tags(ctx context.Context, job *model.Job) ([]*model.JobTag, error) {
@ -468,8 +468,8 @@ func (r *clusterResolver) FilterRanges(
panic("expected exactly one row")
}
duration := &model.IntRangeOutput{};
numNodes := &model.IntRangeOutput{};
duration := &model.IntRangeOutput{}
numNodes := &model.IntRangeOutput{}
var startTimeMin, startTimeMax int64
err = rows.Scan(&duration.From, &duration.To,
@ -479,9 +479,9 @@ func (r *clusterResolver) FilterRanges(
return nil, err
}
startTime := &model.TimeRangeOutput {
time.Unix(startTimeMin, 0), time.Unix(startTimeMax, 0) }
return &model.FilterRanges{ duration, numNodes, startTime }, nil
startTime := &model.TimeRangeOutput{
time.Unix(startTimeMin, 0), time.Unix(startTimeMax, 0)}
return &model.FilterRanges{duration, numNodes, startTime}, nil
}
func (r *Resolver) Job() generated.JobResolver { return &jobResolver{r} }

View File

@ -36,7 +36,7 @@ func main() {
r.Handle("/query", srv)
log.Printf("connect to http://localhost:%s/ for GraphQL playground", port)
log.Fatal(http.ListenAndServe("127.0.0.1:" + port,
log.Fatal(http.ListenAndServe("127.0.0.1:"+port,
handlers.CORS(handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"}),
handlers.AllowedMethods([]string{"GET", "POST", "HEAD", "OPTIONS"}),
handlers.AllowedOrigins([]string{"*"}))(loggedRouter)))