From 6105f5a58378ba809e4ee77a94cebff7f54f96ad Mon Sep 17 00:00:00 2001 From: borg323 <39573933+borg323@users.noreply.github.com> Date: Wed, 5 Sep 2018 14:02:49 +0300 Subject: [PATCH 1/3] add keep option (#53) --- lc0_main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lc0_main.go b/lc0_main.go index f62ef36..4b51f5e 100644 --- a/lc0_main.go +++ b/lc0_main.go @@ -46,6 +46,7 @@ var ( `Options for the lc0 mux. backend. Example: --backend-opts="cudnn(gpu=1)"`) parallel = flag.Int("parallelism", -1, "Number of games to play in parallel (-1 for default)") useTestServer = flag.Bool("use-test-server", false, "Set host name to test server.") + keep = flag.Bool("keep", false, "Do not delete old network files") ) // Settings holds username and password. @@ -624,7 +625,7 @@ func nextGame(httpClient *http.Client, count int) error { } if nextGame.Type == "train" { - networkPath, err := getNetwork(httpClient, nextGame.Sha, true) + networkPath, err := getNetwork(httpClient, nextGame.Sha, !*keep) if err != nil { return err } From 36967318a216f096e6e6b703dc78c0ddf285edf9 Mon Sep 17 00:00:00 2001 From: Tilps Date: Tue, 11 Sep 2018 09:50:10 +1000 Subject: [PATCH 2/3] Add a random per session id token for load balancing multiple clients for single user. (#55) * Add a random per session id token for load balancing multiple clients for single user. * Address review comments. --- lc0_main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lc0_main.go b/lc0_main.go index 4b51f5e..29f0ca8 100644 --- a/lc0_main.go +++ b/lc0_main.go @@ -7,6 +7,7 @@ import ( "bufio" "bytes" "compress/gzip" + "crypto/rand" "encoding/json" "errors" "flag" @@ -35,6 +36,7 @@ var ( startTime time.Time totalGames int pendingNextGame *client.NextGameResponse + randId int hostname = flag.String("hostname", "http://api.lczero.org", "Address of the server") user = flag.String("user", "", "Username") @@ -100,6 +102,7 @@ func getExtraParams() map[string]string { "user": *user, "password": *password, "version": "17", + "token": strconv.Itoa(randId), } } @@ -697,6 +700,13 @@ func hideLc0argsFlag() { } func main() { + randBytes := make([]byte, 2) + _, err := rand.Reader.Read(randBytes) + if err != nil { + randId = -1 + } else { + randId = int(randBytes[0]) << 8 | int(randBytes[1]) + } testEP() hideLc0argsFlag() From 41287eaf5c958e8546bb780368ac7ba627c33c81 Mon Sep 17 00:00:00 2001 From: Tilps Date: Tue, 11 Sep 2018 11:18:26 +1000 Subject: [PATCH 3/3] Bump version for release. --- lc0_main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lc0_main.go b/lc0_main.go index 29f0ca8..fa8bd3f 100644 --- a/lc0_main.go +++ b/lc0_main.go @@ -101,7 +101,7 @@ func getExtraParams() map[string]string { return map[string]string{ "user": *user, "password": *password, - "version": "17", + "version": "18", "token": strconv.Itoa(randId), } }