1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 08:16:43 +00:00
This commit is contained in:
2020-04-12 10:44:32 +08:00
parent 6714dd5779
commit f398523ba6
4 changed files with 25 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
"encoding/json"
"os"
"time"
)
var addr = flag.String("addr", "0.0.0.0:8080", "http service address")
@@ -35,6 +36,7 @@ func serverAPI(w http.ResponseWriter, r *http.Request) {
log.Debug("job_submit")
msgSubmit := MsgSubmit{Code: 0}
err := json.Unmarshal([]byte(string(r.PostFormValue("job"))), &job)
log.Info("Submit job", job.Name, time.Now())
if err != nil {
msgSubmit.Code = 1
msgSubmit.Error = err.Error()
@@ -95,6 +97,13 @@ func serverAPI(w http.ResponseWriter, r *http.Request) {
w.Write(js)
break
case "get_bindings":
log.Debug("get_bindings")
js, _ := json.Marshal(pool.getBindings())
w.Header().Set("Content-Type", "application/json")
w.Write(js)
break
case "group_list":
log.Debug("group_list")
js, _ := json.Marshal(InstanceOfGroupManager().List())