Skip to content

Allow for anchor net in regression testing. #87

@AlexisOlson

Description

@AlexisOlson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions