mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 00:47:26 +01:00
remove JobData, add hasProfile, rename Job-Metrics-Query
This commit is contained in:
parent
1d8b9a96c7
commit
7e32855030
File diff suppressed because it is too large
Load Diff
@ -34,28 +34,6 @@ type IntRange struct {
|
||||
To int `json:"to"`
|
||||
}
|
||||
|
||||
type JobData struct {
|
||||
LoadOne *JobMetric `json:"load_one"`
|
||||
MemUsed *JobMetric `json:"mem_used"`
|
||||
MemBw *JobMetric `json:"mem_bw"`
|
||||
FlopsAny *JobMetric `json:"flops_any"`
|
||||
FlopsDp *JobMetric `json:"flops_dp"`
|
||||
FlopsSp *JobMetric `json:"flops_sp"`
|
||||
CpiAvg *JobMetric `json:"cpi_avg"`
|
||||
ClockSpeed *JobMetric `json:"clock_speed"`
|
||||
TotalPower *JobMetric `json:"total_power"`
|
||||
TrafficReadEth *JobMetric `json:"traffic_read_eth"`
|
||||
TrafficWriteEth *JobMetric `json:"traffic_write_eth"`
|
||||
TrafficReadLustre *JobMetric `json:"traffic_read_lustre"`
|
||||
TrafficWriteLustre *JobMetric `json:"traffic_write_lustre"`
|
||||
RegReadLustre *JobMetric `json:"reg_read_lustre"`
|
||||
RegWriteLustre *JobMetric `json:"reg_write_lustre"`
|
||||
InodesLustre *JobMetric `json:"inodes_lustre"`
|
||||
PkgRateReadIb *JobMetric `json:"pkg_rate_read_ib"`
|
||||
PkgRateWriteIb *JobMetric `json:"pkg_rate_write_ib"`
|
||||
CongestionIb *JobMetric `json:"congestion_ib"`
|
||||
}
|
||||
|
||||
type JobFilter struct {
|
||||
JobID *StringInput `json:"jobId"`
|
||||
UserID *StringInput `json:"userId"`
|
||||
|
@ -88,7 +88,7 @@ func buildQueryConditions(filterList *model.JobFilterList) string {
|
||||
}
|
||||
|
||||
func readJobDataFile(jobId string) ([]byte, error) {
|
||||
// TODO: What to do with the suffix?
|
||||
// TODO: Use suffix as cluster-id!
|
||||
jobId = strings.Split(jobId, ".")[0]
|
||||
id, err := strconv.Atoi(jobId)
|
||||
if err != nil {
|
||||
@ -273,26 +273,9 @@ func (r *queryResolver) JobsStatistics(
|
||||
return &stats, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) JobDataByID(
|
||||
ctx context.Context, jobId string) (*model.JobData, error) {
|
||||
|
||||
f, err := readJobDataFile(jobId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
jobData := new(model.JobData)
|
||||
err = json.Unmarshal(f, jobData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return jobData, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) JobAvailableMetricsByID(
|
||||
func (r *queryResolver) JobMetrics(
|
||||
ctx context.Context, jobId string,
|
||||
selectMetrics []*string) ([]*model.JobMetricWithName, error) {
|
||||
metrics []*string) ([]*model.JobMetricWithName, error) {
|
||||
|
||||
f, err := readJobDataFile(jobId)
|
||||
if err != nil {
|
||||
@ -313,7 +296,7 @@ func (r *queryResolver) JobAvailableMetricsByID(
|
||||
}
|
||||
|
||||
for name, metric := range metricMap {
|
||||
if selectMetrics == nil || contains(selectMetrics, name) {
|
||||
if metrics == nil || contains(metrics, name) {
|
||||
list = append(list, &model.JobMetricWithName{ name, metric })
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
type Job {
|
||||
id: ID!
|
||||
jobId: String!
|
||||
userId: String!
|
||||
projectId: String!
|
||||
@ -7,28 +6,7 @@ type Job {
|
||||
startTime: Time!
|
||||
duration: Int!
|
||||
numNodes: Int!
|
||||
}
|
||||
|
||||
type JobData {
|
||||
load_one: JobMetric
|
||||
mem_used: JobMetric
|
||||
mem_bw: JobMetric
|
||||
flops_any: JobMetric
|
||||
flops_dp: JobMetric
|
||||
flops_sp: JobMetric
|
||||
cpi_avg: JobMetric
|
||||
clock_speed: JobMetric
|
||||
total_power: JobMetric
|
||||
traffic_read_eth: JobMetric
|
||||
traffic_write_eth: JobMetric
|
||||
traffic_read_lustre: JobMetric
|
||||
traffic_write_lustre: JobMetric
|
||||
reg_read_lustre: JobMetric
|
||||
reg_write_lustre: JobMetric
|
||||
inodes_lustre: JobMetric
|
||||
pkg_rate_read_ib: JobMetric
|
||||
pkg_rate_write_ib: JobMetric
|
||||
congestion_ib: JobMetric
|
||||
hasProfile: Boolean!
|
||||
}
|
||||
|
||||
type JobMetric {
|
||||
@ -60,9 +38,7 @@ type Query {
|
||||
jobById(jobId: String!): Job
|
||||
jobs(filter: JobFilterList, page: PageRequest, order: OrderByInput): JobResultList!
|
||||
jobsStatistics(filter: JobFilterList): JobsStatistics!
|
||||
|
||||
jobDataById(jobId: String!): JobData
|
||||
jobAvailableMetricsById(jobId: String!, selectMetrics: [String]): [JobMetricWithName]!
|
||||
jobMetrics(jobId: String!, metrics: [String]): [JobMetricWithName]!
|
||||
}
|
||||
|
||||
input StartJobInput {
|
||||
|
@ -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:8080",
|
||||
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)))
|
||||
|
Loading…
Reference in New Issue
Block a user