cc-backend/internal/scheduler/slurmRest.go

40 lines
1.1 KiB
Go
Raw Normal View History

2023-06-22 08:25:32 +02:00
// Copyright (C) 2023 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.
package scheduler
import "encoding/json"
type SlurmRestSchedulerConfig struct {
URL string `json:"url"`
}
type SlurmRestScheduler struct {
url string
}
func (sd *SlurmRestScheduler) Init(rawConfig json.RawMessage) error {
// cfg := slurmrest.NewConfiguration()
// cfg.HTTPClient = &http.Client{Timeout: time.Second * 3600}
// cfg.Scheme = "http"
// cfg.Host = "localhost"
2023-06-22 08:25:32 +02:00
// client := slurmrest.NewAPIClient(cfg)
2023-06-22 08:25:32 +02:00
return nil
}
func (sd *SlurmRestScheduler) Sync() {
// jreq := client.SlurmApi.SlurmctldGetJobs(context.Background())
// jobs, resp, err := client.SlurmApi.SlurmctldGetJobsExecute(jreq)
// if err != nil {
// log.Fatalf("FAIL: %s", err)
// } else if resp.StatusCode != 200 {
// log.Fatalf("Invalid status code: %d\n", resp.StatusCode)
// }
2023-06-22 08:25:32 +02:00
// for _, job := range jobs.GetJobs() {
// fmt.Printf("Job %s - %s\n", job.GetJobId(), job.GetJobState())
// }
2023-06-22 08:25:32 +02:00
}