@@ -893,7 +893,7 @@ def _run_migrator(
893
893
temp : list [AnyStr ],
894
894
time_per : float ,
895
895
git_backend : GitPlatformBackend ,
896
- package : str | None = None ,
896
+ feedstock : str | None = None ,
897
897
) -> int :
898
898
"""
899
899
Run a migrator.
@@ -903,7 +903,8 @@ def _run_migrator(
903
903
:param temp: The list of temporary files.
904
904
:param time_per: The time limit of this migrator.
905
905
:param git_backend: The GitPlatformBackend instance to use.
906
- :param package: The package to update, if None, all packages are updated.
906
+ :param feedstock: The feedstock to update, if None, all feedstocks are updated. Does not contain the `-feedstock`
907
+ suffix.
907
908
908
909
:return: The number of "good" PRs created by the migrator.
909
910
"""
@@ -928,14 +929,14 @@ def _run_migrator(
928
929
929
930
possible_nodes = list (migrator .order (effective_graph , mctx .graph ))
930
931
931
- if package :
932
- if package not in possible_nodes :
932
+ if feedstock :
933
+ if feedstock not in possible_nodes :
933
934
logger .info (
934
- f"Package { package } is not a candidate for migration of { migrator_name } . "
935
+ f"Feedstock { feedstock } is not a candidate for migration of { migrator_name } . "
935
936
f"If you want to investigate this, run the make-migrators command."
936
937
)
937
938
return 0
938
- possible_nodes = [package ]
939
+ possible_nodes = [feedstock ]
939
940
940
941
# version debugging info
941
942
if isinstance (migrator , Version ):
@@ -1085,17 +1086,18 @@ def _setup_limits():
1085
1086
resource .setrlimit (resource .RLIMIT_AS , (limit_int , limit_int ))
1086
1087
1087
1088
1088
- def _update_nodes_with_bot_rerun (gx : nx .DiGraph , package : str | None = None ):
1089
+ def _update_nodes_with_bot_rerun (gx : nx .DiGraph , feedstock : str | None = None ):
1089
1090
"""
1090
1091
Go through all the open PRs and check if they are rerun
1091
1092
1092
1093
:param gx: the dependency graph
1093
- :param package: the package to update, if None, all packages are updated
1094
+ :param feedstock: The feedstock to update. If None, all feedstocks are updated. Does not contain the `-feedstock`
1095
+ suffix.
1094
1096
"""
1095
1097
1096
1098
print ("processing bot-rerun labels" , flush = True )
1097
1099
1098
- nodes = gx .nodes .items () if not package else [(package , gx .nodes [package ])]
1100
+ nodes = gx .nodes .items () if not feedstock else [(feedstock , gx .nodes [feedstock ])]
1099
1101
1100
1102
for i , (name , node ) in enumerate (nodes ):
1101
1103
# logger.info(
@@ -1154,21 +1156,24 @@ def _filter_ignored_versions(attrs, version):
1154
1156
return version
1155
1157
1156
1158
1157
- def _update_nodes_with_new_versions (gx : nx .DiGraph , package : str | None = None ):
1159
+ def _update_nodes_with_new_versions (gx : nx .DiGraph , feedstock : str | None = None ):
1158
1160
"""
1159
1161
Updates every node with its new version (when available)
1160
1162
1161
1163
:param gx: the dependency graph
1162
- :param package: the package to update, if None, all packages are updated
1164
+ :param feedstock: the feedstock to update, if None, all feedstocks are updated. Does not contain the `-feedstock`
1165
+ suffix.
1163
1166
"""
1164
1167
1165
1168
print ("updating nodes with new versions" , flush = True )
1166
1169
1167
- if package and not does_key_exist_in_hashmap ("versions" , package ):
1168
- logger .warning (f"Package { package } not found in versions hashmap" )
1170
+ if feedstock and not does_key_exist_in_hashmap ("versions" , feedstock ):
1171
+ logger .warning (f"Feedstock { feedstock } not found in versions hashmap" )
1169
1172
return
1170
1173
1171
- version_nodes = get_all_keys_for_hashmap ("versions" ) if not package else [package ]
1174
+ version_nodes = (
1175
+ get_all_keys_for_hashmap ("versions" ) if not feedstock else [feedstock ]
1176
+ )
1172
1177
1173
1178
for node in version_nodes :
1174
1179
version_data = LazyJson (f"versions/{ node } .json" ).data
@@ -1194,27 +1199,32 @@ def _update_nodes_with_new_versions(gx: nx.DiGraph, package: str | None = None):
1194
1199
vpri ["new_version" ] = version_from_data
1195
1200
1196
1201
1197
- def _remove_closed_pr_json (package : str | None = None ):
1202
+ def _remove_closed_pr_json (feedstock : str | None = None ):
1198
1203
"""
1199
1204
Remove the pull request information for closed PRs.
1200
1205
1201
- :param package: The package to remove the PR information for. If None, all PR information is removed. If you pass
1202
- a package, closed pr_json files are not removed because this would require iterating all pr_json files.
1206
+ :param feedstock: The feedstock to remove the PR information for. If None, all PR information is removed. If you pass
1207
+ a feedstock, closed pr_json files are not removed because this would require iterating all pr_json files. Does not
1208
+ contain the `-feedstock` suffix.
1203
1209
"""
1204
1210
print ("collapsing closed PR json" , flush = True )
1205
1211
1206
- if package :
1212
+ if feedstock :
1207
1213
pr_info_nodes = (
1208
- [package ] if does_key_exist_in_hashmap ("pr_info" , package ) else []
1214
+ [feedstock ] if does_key_exist_in_hashmap ("pr_info" , feedstock ) else []
1209
1215
)
1210
1216
version_pr_info_nodes = (
1211
- [package ] if does_key_exist_in_hashmap ("version_pr_info" , package ) else []
1217
+ [feedstock ]
1218
+ if does_key_exist_in_hashmap ("version_pr_info" , feedstock )
1219
+ else []
1212
1220
)
1213
1221
1214
1222
if not pr_info_nodes :
1215
- logger .warning (f"Package { package } not found in pr_info hashmap" )
1223
+ logger .warning (f"Feedstock { feedstock } not found in pr_info hashmap" )
1216
1224
if not version_pr_info_nodes :
1217
- logger .warning (f"Package { package } not found in version_pr_info hashmap" )
1225
+ logger .warning (
1226
+ f"Feedstock { feedstock } not found in version_pr_info hashmap"
1227
+ )
1218
1228
else :
1219
1229
pr_info_nodes = get_all_keys_for_hashmap ("pr_info" )
1220
1230
version_pr_info_nodes = get_all_keys_for_hashmap ("version_pr_info" )
@@ -1255,7 +1265,7 @@ def _remove_closed_pr_json(package: str | None = None):
1255
1265
1256
1266
# at this point, any json blob referenced in the pr info is state != closed
1257
1267
# so we can remove anything that is empty or closed
1258
- if package :
1268
+ if feedstock :
1259
1269
logger .info (
1260
1270
"Since you requested a run for a specific package, we are not removing closed pr_json files."
1261
1271
)
@@ -1270,22 +1280,32 @@ def _remove_closed_pr_json(package: str | None = None):
1270
1280
)
1271
1281
1272
1282
1273
- def _update_graph_with_pr_info (package : str | None = None ):
1274
- _remove_closed_pr_json (package )
1283
+ def _update_graph_with_pr_info (feedstock : str | None = None ):
1284
+ """
1285
+ :param feedstock: The feedstock to update the graph for. If None, all feedstocks are updated. Does not contain the
1286
+ `-feedstock` suffix.
1287
+ """
1288
+ _remove_closed_pr_json (feedstock )
1275
1289
gx = load_existing_graph ()
1276
- _update_nodes_with_bot_rerun (gx , package )
1277
- _update_nodes_with_new_versions (gx , package )
1290
+ _update_nodes_with_bot_rerun (gx , feedstock )
1291
+ _update_nodes_with_new_versions (gx , feedstock )
1278
1292
dump_graph (gx )
1279
1293
1280
1294
1281
- def main (ctx : CliContext , package : str | None = None ) -> None :
1295
+ def main (ctx : CliContext , feedstock : str | None = None ) -> None :
1296
+ """
1297
+ Run the main bot logic.
1298
+
1299
+ :param ctx: The CLI context.
1300
+ :param feedstock: If not None, only the given feedstock is updated. Does not contain the `-feedstock` suffix.
1301
+ """
1282
1302
global START_TIME
1283
1303
START_TIME = time .time ()
1284
1304
1285
1305
_setup_limits ()
1286
1306
1287
1307
with fold_log_lines ("updating graph with PR info" ):
1288
- _update_graph_with_pr_info (package )
1308
+ _update_graph_with_pr_info (feedstock )
1289
1309
deploy (ctx , dirs_to_deploy = ["version_pr_info" , "pr_json" , "pr_info" ])
1290
1310
1291
1311
# record tmp dir so we can be sure to clean it later
@@ -1339,7 +1359,7 @@ def main(ctx: CliContext, package: str | None = None) -> None:
1339
1359
1340
1360
for mg_ind , migrator in enumerate (migrators ):
1341
1361
good_prs = _run_migrator (
1342
- migrator , mctx , temp , time_per_migrator [mg_ind ], git_backend , package
1362
+ migrator , mctx , temp , time_per_migrator [mg_ind ], git_backend , feedstock
1343
1363
)
1344
1364
if good_prs > 0 :
1345
1365
pass
0 commit comments