Skip to content

Commit 2feecb9

Browse files
xsh310Isaac
andauthored
Address review: make walk_catalog_schemas worker count a param
Rename _UC_FUNCTION_PROBE_WORKERS -> _SCHEMA_PROBE_WORKERS (a generic per-schema concurrency cap, not UC-function-specific) and expose it as the max_workers param, mirroring skip_catalogs. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 1333200 commit 2feecb9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/ucode/databricks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,7 @@ def resolve_provider_launch_model(model: str | None, provider_models: dict[str,
24492449

24502450
_UC_LIST_PAGE_SIZE = 200
24512451
_UC_LIST_MAX_PAGES = 50
2452-
_UC_FUNCTION_PROBE_WORKERS = 16
2452+
_SCHEMA_PROBE_WORKERS = 16
24532453
_UC_LIST_HTTP_TIMEOUT = 10
24542454
# Most MCP services live outside `system.ai`, so this workspace-wide walk needs
24552455
# enough time to enumerate them; a slow workspace still degrades to partial
@@ -2531,6 +2531,7 @@ def walk_catalog_schemas[T](
25312531
probe: Callable[[str, str], T],
25322532
collect: Callable[[T, int, int], None],
25332533
skip_catalogs: frozenset[str] = _UC_FUNCTIONS_SKIP_CATALOGS,
2534+
max_workers: int = _SCHEMA_PROBE_WORKERS,
25342535
) -> str | None:
25352536
"""Discover every user `<catalog>.<schema>` in the workspace and probe each one in parallel.
25362537
@@ -2567,7 +2568,7 @@ def walk_catalog_schemas[T](
25672568
return "deadline exceeded while listing UC catalogs"
25682569

25692570
schema_refs: list[tuple[str, str]] = []
2570-
schema_workers = max(1, min(_UC_FUNCTION_PROBE_WORKERS, len(catalog_names)))
2571+
schema_workers = max(1, min(max_workers, len(catalog_names)))
25712572
with ThreadPoolExecutor(max_workers=schema_workers) as pool:
25722573
schema_futures = {
25732574
pool.submit(
@@ -2602,7 +2603,7 @@ def collect_schemas(result, catalog):
26022603

26032604
schemas_total = len(schema_refs)
26042605
schemas_done = 0
2605-
probe_workers = max(1, min(_UC_FUNCTION_PROBE_WORKERS, schemas_total))
2606+
probe_workers = max(1, min(max_workers, schemas_total))
26062607
with ThreadPoolExecutor(max_workers=probe_workers) as pool:
26072608
probe_futures = {
26082609
pool.submit(probe, catalog, schema): (catalog, schema)

0 commit comments

Comments
 (0)