1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 16:16:44 +00:00

set parallelism

This commit is contained in:
2020-04-13 23:53:38 +08:00
parent 490a6b3928
commit ca3ac7aea1
6 changed files with 44 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import (
"encoding/json"
"os"
"time"
"strconv"
)
var addr = flag.String("addr", "0.0.0.0:8080", "http service address")
@@ -180,6 +181,14 @@ func serverAPI(w http.ResponseWriter, r *http.Request) {
w.Write(js)
break
case "debug_update_parallelism":
log.Debug("update_parallelism")
parallelism, _ := strconv.Atoi(r.URL.Query().Get("parallelism"))
js, _ := json.Marshal(scheduler.UpdateParallelism(parallelism))
w.Header().Set("Content-Type", "application/json")
w.Write(js)
break
default:
http.Error(w, "Not Found", http.StatusNotFound)
break