LeelaChessZero / LeelaChessZero/lczero-client

Allow for anchor net in regression testing.

Open
#87 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
74
Forks
42
PR merge metrics
No merged PRs in 30d

Description

To allow anchor net to be avaiable to test against similar to the code in lczero-server/main.go here:

[...]
	// Regression tests for current best.  Done here because the 'end of match' code logic isn't thread safe, so could create matches multiple times.
	var prevNetwork1 db.Network
	err = db.GetDB().Where("network_number = ?", bestNetwork.NetworkNumber-3).First(&prevNetwork1).Error
	if err == nil {
		createMatch(trainingRun, &prevNetwork1, true, string(params[:]))
	}
	var prevNetwork2 db.Network
	err = db.GetDB().Where("network_number = ?", bestNetwork.NetworkNumber-10).First(&prevNetwork2).Error
	if err == nil {
		createMatch(trainingRun, &prevNetwork2, true, string(params[:]))
	}
[...]

the desired network would need to be available. The following code in lczero-client/lc0_main.go deletes old networks:

[...]
func removeAllExcept(dir string, sha string, keepTime string) error {
	files, err := ioutil.ReadDir(dir)
	if err != nil {
		return err
	}
	for _, file := range files {
		if file.Name() == sha {
			continue
		}
		timeLimit, _ := time.ParseDuration(keepTime)
		if time.Since(file.ModTime()) < timeLimit {
			continue
		}
		fmt.Printf("Removing %v\n", file.Name())
		err := os.RemoveAll(filepath.Join(dir, file.Name()))
		if err != nil {
			return err
		}
	}
	return nil
}
[...]

However, it should be relatively simple to include a condition to not delete specific networks. E.g.

		if file.Name() == "5c222ccd1ccbed2666b3a8ef94d8833d386d2168d51c3e99a0a3fc37a56d2569" {
			continue
		}

It would probably be better to store the sha in a variable declaration or a configuration file.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lc0_main.go at removeAllExcept and trace its callers and network-retention configuration. Decide how the specified anchor network should be identified and preserved without disrupting existing cleanup. Done means the anchor network remains available for regression testing while other eligible old networks are still removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.