2022-07-29 06:29:21 +02:00
|
|
|
// Copyright (C) 2022 NHR@FAU, University Erlangen-Nuremberg.
|
|
|
|
// All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
2022-01-24 10:06:25 +01:00
|
|
|
package metricdata
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-03-17 16:15:35 +01:00
|
|
|
"encoding/json"
|
2022-01-31 15:16:05 +01:00
|
|
|
"time"
|
2022-01-24 10:06:25 +01:00
|
|
|
|
2022-06-21 17:52:36 +02:00
|
|
|
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
2022-01-24 10:06:25 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var TestLoadDataCallback func(job *schema.Job, metrics []string, scopes []schema.MetricScope, ctx context.Context) (schema.JobData, error) = func(job *schema.Job, metrics []string, scopes []schema.MetricScope, ctx context.Context) (schema.JobData, error) {
|
|
|
|
panic("TODO")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only a mock for unit-testing.
|
2022-03-17 16:15:35 +01:00
|
|
|
type TestMetricDataRepository struct{}
|
2022-01-24 10:06:25 +01:00
|
|
|
|
2022-03-17 16:15:35 +01:00
|
|
|
func (tmdr *TestMetricDataRepository) Init(_ json.RawMessage) error {
|
2022-01-24 10:06:25 +01:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-09-07 12:24:45 +02:00
|
|
|
func (tmdr *TestMetricDataRepository) LoadData(
|
|
|
|
job *schema.Job,
|
|
|
|
metrics []string,
|
|
|
|
scopes []schema.MetricScope,
|
|
|
|
ctx context.Context) (schema.JobData, error) {
|
|
|
|
|
2022-01-24 10:06:25 +01:00
|
|
|
return TestLoadDataCallback(job, metrics, scopes, ctx)
|
|
|
|
}
|
|
|
|
|
2022-09-07 12:24:45 +02:00
|
|
|
func (tmdr *TestMetricDataRepository) LoadStats(
|
|
|
|
job *schema.Job,
|
|
|
|
metrics []string, ctx context.Context) (map[string]map[string]schema.MetricStatistics, error) {
|
|
|
|
|
2022-01-24 10:06:25 +01:00
|
|
|
panic("TODO")
|
|
|
|
}
|
|
|
|
|
2022-09-07 12:24:45 +02:00
|
|
|
func (tmdr *TestMetricDataRepository) LoadNodeData(
|
|
|
|
cluster string,
|
|
|
|
metrics, nodes []string,
|
|
|
|
scopes []schema.MetricScope,
|
|
|
|
from, to time.Time,
|
|
|
|
ctx context.Context) (map[string]map[string][]*schema.JobMetric, error) {
|
|
|
|
|
2022-01-24 10:06:25 +01:00
|
|
|
panic("TODO")
|
|
|
|
}
|