mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +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"`
|
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 {
|
type JobFilter struct {
|
||||||
JobID *StringInput `json:"jobId"`
|
JobID *StringInput `json:"jobId"`
|
||||||
UserID *StringInput `json:"userId"`
|
UserID *StringInput `json:"userId"`
|
||||||
|
@ -88,7 +88,7 @@ func buildQueryConditions(filterList *model.JobFilterList) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readJobDataFile(jobId string) ([]byte, error) {
|
func readJobDataFile(jobId string) ([]byte, error) {
|
||||||
// TODO: What to do with the suffix?
|
// TODO: Use suffix as cluster-id!
|
||||||
jobId = strings.Split(jobId, ".")[0]
|
jobId = strings.Split(jobId, ".")[0]
|
||||||
id, err := strconv.Atoi(jobId)
|
id, err := strconv.Atoi(jobId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -273,26 +273,9 @@ func (r *queryResolver) JobsStatistics(
|
|||||||
return &stats, nil
|
return &stats, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) JobDataByID(
|
func (r *queryResolver) JobMetrics(
|
||||||
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(
|
|
||||||
ctx context.Context, jobId string,
|
ctx context.Context, jobId string,
|
||||||
selectMetrics []*string) ([]*model.JobMetricWithName, error) {
|
metrics []*string) ([]*model.JobMetricWithName, error) {
|
||||||
|
|
||||||
f, err := readJobDataFile(jobId)
|
f, err := readJobDataFile(jobId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -313,7 +296,7 @@ func (r *queryResolver) JobAvailableMetricsByID(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, metric := range metricMap {
|
for name, metric := range metricMap {
|
||||||
if selectMetrics == nil || contains(selectMetrics, name) {
|
if metrics == nil || contains(metrics, name) {
|
||||||
list = append(list, &model.JobMetricWithName{ name, metric })
|
list = append(list, &model.JobMetricWithName{ name, metric })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
type Job {
|
type Job {
|
||||||
id: ID!
|
|
||||||
jobId: String!
|
jobId: String!
|
||||||
userId: String!
|
userId: String!
|
||||||
projectId: String!
|
projectId: String!
|
||||||
@ -7,28 +6,7 @@ type Job {
|
|||||||
startTime: Time!
|
startTime: Time!
|
||||||
duration: Int!
|
duration: Int!
|
||||||
numNodes: Int!
|
numNodes: Int!
|
||||||
}
|
hasProfile: Boolean!
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobMetric {
|
type JobMetric {
|
||||||
@ -60,9 +38,7 @@ type Query {
|
|||||||
jobById(jobId: String!): Job
|
jobById(jobId: String!): Job
|
||||||
jobs(filter: JobFilterList, page: PageRequest, order: OrderByInput): JobResultList!
|
jobs(filter: JobFilterList, page: PageRequest, order: OrderByInput): JobResultList!
|
||||||
jobsStatistics(filter: JobFilterList): JobsStatistics!
|
jobsStatistics(filter: JobFilterList): JobsStatistics!
|
||||||
|
jobMetrics(jobId: String!, metrics: [String]): [JobMetricWithName]!
|
||||||
jobDataById(jobId: String!): JobData
|
|
||||||
jobAvailableMetricsById(jobId: String!, selectMetrics: [String]): [JobMetricWithName]!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input StartJobInput {
|
input StartJobInput {
|
||||||
|
@ -36,7 +36,7 @@ func main() {
|
|||||||
r.Handle("/query", srv)
|
r.Handle("/query", srv)
|
||||||
|
|
||||||
log.Printf("connect to http://localhost:%s/ for GraphQL playground", port)
|
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.CORS(handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"}),
|
||||||
handlers.AllowedMethods([]string{"GET", "POST", "HEAD", "OPTIONS"}),
|
handlers.AllowedMethods([]string{"GET", "POST", "HEAD", "OPTIONS"}),
|
||||||
handlers.AllowedOrigins([]string{"*"}))(loggedRouter)))
|
handlers.AllowedOrigins([]string{"*"}))(loggedRouter)))
|
||||||
|
Loading…
Reference in New Issue
Block a user