@@ -1199,6 +1199,7 @@ def run_code_half(
11991199 global_symbol_index : Path | None = None ,
12001200 memory_limit_gb : float = 10.0 ,
12011201 parse_workers : int = 2 ,
1202+ index_timeout_s : int | None = None ,
12021203) -> dict :
12031204 """index+route+pack the repo's source via the EXISTING code stage, zstd-max.
12041205
@@ -1214,7 +1215,7 @@ def run_code_half(
12141215 try :
12151216 info = sr .process_one_repo (
12161217 repo , repo_dir , lengths_code , work_root , dedup_db , dedup_near ,
1217- global_symbol_index , memory_limit_gb , parse_workers ,
1218+ global_symbol_index , memory_limit_gb , parse_workers , index_timeout_s ,
12181219 promote_dedup_on_success = False ,
12191220 )
12201221 # zstd-max the per-length code parquet files this repo just wrote.
@@ -1245,6 +1246,7 @@ def run_code_half(
12451246 Path | None ,
12461247 float ,
12471248 int ,
1249+ int | None ,
12481250 ],
12491251 dict ,
12501252]
@@ -1309,6 +1311,7 @@ def run_code_half_adaptive(
13091311 global_symbol_index : Path | None = None ,
13101312 memory_limit_gb : float = 10.0 ,
13111313 parse_workers : int = 2 ,
1314+ index_timeout_s : int | None = None ,
13121315 * ,
13131316 runner : CodeRunner | None = None ,
13141317 isolate_dedup_on_retry : bool = True ,
@@ -1331,6 +1334,7 @@ def run_code_half_adaptive(
13311334 global_symbol_index ,
13321335 memory_limit_gb ,
13331336 parse_workers ,
1337+ index_timeout_s ,
13341338 )
13351339 except RepoFailure as exc :
13361340 if parse_workers <= 1 or not is_index_project_memory_failure (exc ):
@@ -1352,6 +1356,7 @@ def run_code_half_adaptive(
13521356 global_symbol_index ,
13531357 memory_limit_gb ,
13541358 1 ,
1359+ index_timeout_s ,
13551360 )
13561361
13571362
@@ -2002,6 +2007,7 @@ def process_one_repo(
20022007 * ,
20032008 code_memory_limit_gb : float | None = None ,
20042009 commit_memory_limit_gb : float | None = None ,
2010+ code_index_timeout_s : int | None = None ,
20052011 reservations : UnitReservationLedger | None = None ,
20062012 range_submit_window : int = 1 ,
20072013 analysis_cache_entries : int = 128 ,
@@ -2086,6 +2092,7 @@ def process_one_repo(
20862092 repo , repo_dir , lengths_code , work_root ,
20872093 code_dedup_db , code_dedup_near ,
20882094 global_symbol_index , code_limit , code_parse_workers ,
2095+ code_index_timeout_s ,
20892096 )
20902097 with manifest_lock :
20912098 manifest .mark_done (ck , cinfo )
@@ -2289,6 +2296,9 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
22892296 help = "Parse workers passed to index_project for the CODE half "
22902297 "(default 2; avoid multiplying --repo-workers by the old "
22912298 "index_project default of 8 clang workers)." )
2299+ p .add_argument ("--code-index-timeout-s" , type = int , default = 0 ,
2300+ help = "Optional fail-loud timeout for each CODE index_project "
2301+ "stage. 0 disables the timeout (default)." )
22922302 p .add_argument ("--memory-budget-gb" , type = float , default = None ,
22932303 help = "Global conveyor memory budget for heavy subprocesses. "
22942304 "Default is 55%% of physical RAM (or 48 GiB if RAM size "
@@ -2667,6 +2677,7 @@ def mark_no_git_repo(repo: str) -> None:
26672677 progress , checkpoint ,
26682678 code_memory_limit_gb = code_memory_limit_gb ,
26692679 commit_memory_limit_gb = commit_memory_limit_gb ,
2680+ code_index_timeout_s = args .code_index_timeout_s ,
26702681 reservations = reservations ,
26712682 range_submit_window = range_submit_window ,
26722683 analysis_cache_entries = args .analysis_cache_entries ,
@@ -2756,6 +2767,7 @@ def drain_one_or_more(block: bool = True) -> None:
27562767 progress , checkpoint ,
27572768 code_memory_limit_gb = code_memory_limit_gb ,
27582769 commit_memory_limit_gb = commit_memory_limit_gb ,
2770+ code_index_timeout_s = args .code_index_timeout_s ,
27592771 reservations = reservations ,
27602772 range_submit_window = range_submit_window ,
27612773 analysis_cache_entries = args .analysis_cache_entries ,
0 commit comments