@@ -729,35 +729,34 @@ def get_sha(branch, repo_url):
729729 return "" , ""
730730
731731
732- def get_net (commit_sha , repo_url ):
733- """Get the net from evaluate.h or ucioption.cpp in the repo"""
732+ def get_nets (commit_sha , repo_url ):
733+ """Get the nets from evaluate.h or ucioption.cpp in the repo"""
734734 api_url = repo_url .replace (
735735 "https://github.com" , "https://raw.githubusercontent.com"
736736 )
737737 try :
738- net = None
738+ nets = []
739+ pattern = re .compile ("nn-[a-f0-9]{12}.nnue" )
739740
740741 url1 = api_url + "/" + commit_sha + "/src/evaluate.h"
741742 options = requests .get (url1 ).content .decode ("utf-8" )
742743 for line in options .splitlines ():
743744 if "EvalFileDefaultName" in line and "define" in line :
744- p = re .compile ("nn-[a-z0-9]{12}.nnue" )
745- m = p .search (line )
745+ m = pattern .search (line )
746746 if m :
747- net = m .group (0 )
747+ nets . append ( m .group (0 ) )
748748
749- if net :
750- return net
749+ if nets :
750+ return nets
751751
752752 url2 = api_url + "/" + commit_sha + "/src/ucioption.cpp"
753753 options = requests .get (url2 ).content .decode ("utf-8" )
754754 for line in options .splitlines ():
755755 if "EvalFile" in line and "Option" in line :
756- p = re .compile ("nn-[a-z0-9]{12}.nnue" )
757- m = p .search (line )
756+ m = pattern .search (line )
758757 if m :
759- net = m .group (0 )
760- return net
758+ nets . append ( m .group (0 ) )
759+ return nets
761760 except :
762761 raise Exception ("Unable to access developer repository: " + api_url )
763762
@@ -919,19 +918,29 @@ def strip_message(m):
919918 )
920919 data ["base_same_as_master" ] = master_diff .text == ""
921920
922- # Test existence of net
923- new_net = get_net (data ["resolved_new" ], data ["tests_repo" ])
924- if new_net :
921+ # Test existence of nets
922+ new_nets = get_nets (data ["resolved_new" ], data ["tests_repo" ])
923+ missing_nets = []
924+ for new_net in new_nets :
925925 if not request .rundb .get_nn (new_net ):
926- raise Exception (
927- "The net {}, used by {}, is not "
928- "known to Fishtest. Please upload it to: "
929- "{}/upload." .format (new_net , data ["new_tag" ], request .host_url )
926+ missing_nets .append (new_net )
927+ if missing_nets :
928+ verb , pronoun = ("are" , "them" ) if len (missing_nets ) > 1 else ("is" , "it" )
929+ raise Exception (
930+ "The following net(s): {}, used by {}, {} not "
931+ "known to Fishtest. Please upload {} to: "
932+ "{}/upload." .format (
933+ ", " .join (missing_nets ),
934+ data ["new_tag" ],
935+ verb ,
936+ pronoun ,
937+ request .host_url ,
930938 )
939+ )
931940
932- # Store net info
933- data ["new_net " ] = new_net
934- data ["base_net " ] = get_net (data ["resolved_base" ], data ["tests_repo" ])
941+ # Store nets info
942+ data ["new_nets " ] = new_nets
943+ data ["base_nets " ] = get_nets (data ["resolved_base" ], data ["tests_repo" ])
935944
936945 # Integer parameters
937946 data ["threads" ] = int (request .POST ["threads" ])
@@ -1004,21 +1013,31 @@ def update_nets(request, run):
10041013 run_id = str (run ["_id" ])
10051014 data = run ["args" ]
10061015 if run ["base_same_as_master" ]:
1007- base_net = data ["base_net" ]
1008- if base_net :
1016+ base_nets = data ["base_nets" ]
1017+ missing_nets = []
1018+ for base_net in base_nets :
10091019 net = request .rundb .get_nn (base_net )
10101020 if not net :
10111021 # Should never happen:
1012- raise Exception (
1013- "The net {}, used by {}, is not "
1014- "known to Fishtest. Please upload it to: "
1015- "{}/upload." .format (base_net , data ["base_tag" ], request .host_url )
1016- )
1017- if "is_master" not in net :
1022+ missing_nets .append (base_net )
1023+ elif "is_master" not in net :
10181024 net ["is_master" ] = True
10191025 request .rundb .update_nn (net )
1020- new_net = data ["new_net" ]
1021- if new_net :
1026+ if missing_nets :
1027+ verb , pronoun = ("are" , "them" ) if len (missing_nets ) > 1 else ("is" , "it" )
1028+ raise Exception (
1029+ "The following net(s): {}, used by {}, {} not "
1030+ "known to Fishtest. Please upload {} to: "
1031+ "{}/upload." .format (
1032+ ", " .join (missing_nets ),
1033+ data ["base_tag" ],
1034+ verb ,
1035+ pronoun ,
1036+ request .host_url ,
1037+ )
1038+ )
1039+ new_nets = data ["new_nets" ]
1040+ for new_net in new_nets :
10221041 net = request .rundb .get_nn (new_net )
10231042 if not net :
10241043 return
@@ -1367,11 +1386,13 @@ def tests_view(request):
13671386 "new_options" ,
13681387 "resolved_new" ,
13691388 "new_net" ,
1389+ "new_nets" ,
13701390 "base_tag" ,
13711391 "base_signature" ,
13721392 "base_options" ,
13731393 "resolved_base" ,
13741394 "base_net" ,
1395+ "base_nets" ,
13751396 "sprt" ,
13761397 "num_games" ,
13771398 "spsa" ,
@@ -1401,6 +1422,9 @@ def tests_view(request):
14011422 if name == "base_tag" and "msg_base" in run ["args" ]:
14021423 value += " (" + run ["args" ]["msg_base" ][:50 ] + ")"
14031424
1425+ if name in ("new_nets" , "base_nets" ):
1426+ value = ", " .join (value )
1427+
14041428 if name == "sprt" and value != "-" :
14051429 value = "elo0: {:.2f} alpha: {:.2f} elo1: {:.2f} beta: {:.2f} state: {} ({})" .format (
14061430 value ["elo0" ],
0 commit comments