@@ -893,7 +893,7 @@ def _run_migrator(
893893 temp : list [AnyStr ],
894894 time_per : float ,
895895 git_backend : GitPlatformBackend ,
896- package : str | None = None ,
896+ feedstock : str | None = None ,
897897) -> int :
898898 """
899899 Run a migrator.
@@ -903,7 +903,8 @@ def _run_migrator(
903903 :param temp: The list of temporary files.
904904 :param time_per: The time limit of this migrator.
905905 :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.
907908
908909 :return: The number of "good" PRs created by the migrator.
909910 """
@@ -928,14 +929,14 @@ def _run_migrator(
928929
929930 possible_nodes = list (migrator .order (effective_graph , mctx .graph ))
930931
931- if package :
932- if package not in possible_nodes :
932+ if feedstock :
933+ if feedstock not in possible_nodes :
933934 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 } . "
935936 f"If you want to investigate this, run the make-migrators command."
936937 )
937938 return 0
938- possible_nodes = [package ]
939+ possible_nodes = [feedstock ]
939940
940941 # version debugging info
941942 if isinstance (migrator , Version ):
@@ -1085,17 +1086,18 @@ def _setup_limits():
10851086 resource .setrlimit (resource .RLIMIT_AS , (limit_int , limit_int ))
10861087
10871088
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 ):
10891090 """
10901091 Go through all the open PRs and check if they are rerun
10911092
10921093 :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.
10941096 """
10951097
10961098 print ("processing bot-rerun labels" , flush = True )
10971099
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 ])]
10991101
11001102 for i , (name , node ) in enumerate (nodes ):
11011103 # logger.info(
@@ -1154,21 +1156,24 @@ def _filter_ignored_versions(attrs, version):
11541156 return version
11551157
11561158
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 ):
11581160 """
11591161 Updates every node with its new version (when available)
11601162
11611163 :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.
11631166 """
11641167
11651168 print ("updating nodes with new versions" , flush = True )
11661169
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" )
11691172 return
11701173
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+ )
11721177
11731178 for node in version_nodes :
11741179 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):
11941199 vpri ["new_version" ] = version_from_data
11951200
11961201
1197- def _remove_closed_pr_json (package : str | None = None ):
1202+ def _remove_closed_pr_json (feedstock : str | None = None ):
11981203 """
11991204 Remove the pull request information for closed PRs.
12001205
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.
12031209 """
12041210 print ("collapsing closed PR json" , flush = True )
12051211
1206- if package :
1212+ if feedstock :
12071213 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 []
12091215 )
12101216 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 []
12121220 )
12131221
12141222 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" )
12161224 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+ )
12181228 else :
12191229 pr_info_nodes = get_all_keys_for_hashmap ("pr_info" )
12201230 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):
12551265
12561266 # at this point, any json blob referenced in the pr info is state != closed
12571267 # so we can remove anything that is empty or closed
1258- if package :
1268+ if feedstock :
12591269 logger .info (
12601270 "Since you requested a run for a specific package, we are not removing closed pr_json files."
12611271 )
@@ -1270,22 +1280,32 @@ def _remove_closed_pr_json(package: str | None = None):
12701280 )
12711281
12721282
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 )
12751289 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 )
12781292 dump_graph (gx )
12791293
12801294
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+ """
12821302 global START_TIME
12831303 START_TIME = time .time ()
12841304
12851305 _setup_limits ()
12861306
12871307 with fold_log_lines ("updating graph with PR info" ):
1288- _update_graph_with_pr_info (package )
1308+ _update_graph_with_pr_info (feedstock )
12891309 deploy (ctx , dirs_to_deploy = ["version_pr_info" , "pr_json" , "pr_info" ])
12901310
12911311 # 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:
13391359
13401360 for mg_ind , migrator in enumerate (migrators ):
13411361 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
13431363 )
13441364 if good_prs > 0 :
13451365 pass
0 commit comments