Skip to content

refactor: reuse the global Ray Pool across distributed operations#5199

Open
LuciferYang wants to merge 1 commit into
lance-format:mainfrom
LuciferYang:refactor/reuse-global-pool
Open

refactor: reuse the global Ray Pool across distributed operations#5199
LuciferYang wants to merge 1 commit into
lance-format:mainfrom
LuciferYang:refactor/reuse-global-pool

Conversation

@LuciferYang

Copy link
Copy Markdown

init_global_pool / set_global_pool let you register a process-wide Ray Pool so Lance-Ray operations can share it instead of spinning one up each call, but only vector_search actually reused it. compact_files, create_scalar_index, create_index, and add_columns each built their own Pool, so a configured global Pool was ignored and they paid full pool startup every time.

This routes those four through the existing get_or_create_pool helper. With no global Pool set the behavior is unchanged — a local Pool is created and closed per call; when one is set, it's reused.

One wrinkle worth calling out: a reused global Pool is fixed at the size and remote args it was created with, so per-call num_workers / ray_remote_args no longer apply. The process-count mismatch was already warned about; this adds a matching warning when per-call ray_remote_args are dropped, and lets get_or_create_pool accept processes=None (which add_columns passes). Clearing the global Pool restores per-call control.

compact_files, create_scalar_index, create_index and add_columns each
created a fresh Ray Pool, ignoring a Pool configured via init_global_pool/
set_global_pool. Route them through get_or_create_pool so a configured
global Pool is reused. Warn when an active global Pool causes per-call
ray_remote_args to be ignored, and tolerate processes=None.

Update test_map_async_with_pool_closes_and_joins_pool to patch the Pool in
lance_ray.pool, since the Pool is now constructed there rather than in
lance_ray.index.
@LuciferYang LuciferYang force-pushed the refactor/reuse-global-pool branch from 0d04692 to 0116642 Compare June 22, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant