@@ -1117,46 +1117,30 @@ def subnet_params(self,
1117
1117
update = False ,
1118
1118
max_age = 1000 ,
1119
1119
fmt :str = 'j' ,
1120
- timeout = 30 ,
1121
1120
features = subnet_features ,
1122
1121
value_features = ['min_stake' , 'max_stake' ],
1123
- block = None ,
1124
1122
** kwargs
1125
1123
) -> list :
1126
1124
1127
1125
netuid = self .resolve_netuid (netuid )
1128
1126
1129
-
1130
-
1131
1127
path = f'query/{ network } /SubspaceModule.SubnetParams.{ netuid } '
1132
1128
subnet_params = self .get (path , None , max_age = max_age , update = update )
1133
-
1129
+ names = [self .feature2name (f ) for f in features ]
1130
+ name2feature = dict (zip (names , features ))
1134
1131
if subnet_params == None :
1135
-
1136
- names = [self .feature2name (f ) for f in features ]
1137
- name2feature = dict (zip (names , features ))
1138
- subnet_params = {}
1139
1132
block = self .block
1140
- future2name = {}
1141
- params = [] if netuid == 'all' else [netuid ]
1142
- for name , feature in name2feature .items ():
1143
- f = c .submit (self .query_map , kwargs = dict (name = feature ,params = params , update = update , block = block , ** kwargs ))
1144
- future2name [f ] = name
1145
- for future in c .as_completed (future2name , timeout = timeout ):
1146
- name = future2name [future ]
1147
- subnet_params [name ] = future .result ()
1148
-
1133
+ subnet_params = {}
1134
+ multi_query = [("SubspaceModule" , f , []) for f in name2feature .values ()]
1135
+ results = self .query_multi (multi_query )
1136
+ for idx , (k , v ) in enumerate (results ):
1137
+ subnet_params [names [idx ]] = v .value
1138
+ self .put (path , subnet_params )
1139
+
1140
+ for k in value_features :
1141
+ subnet_params [k ] = self .format_amount (subnet_params [k ], fmt = fmt )
1142
+ return subnet_params
1149
1143
1150
- if netuid == 'all' :
1151
- new_subnet_params = {}
1152
- for name , netuid2value in subnet_params .items ():
1153
- for netuid , value in netuid2value .items ():
1154
- if netuid not in new_subnet_params :
1155
- new_subnet_params [netuid ] = {}
1156
- new_subnet_params [netuid ][name ] = value
1157
- subnet_params = new_subnet_params
1158
- self .put (path , subnet_params )
1159
- c .print (subnet_params )
1160
1144
1161
1145
return subnet_params
1162
1146
0 commit comments