Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit bfbb603

Browse files
stop using callback to cache upload result
1 parent 6047cc0 commit bfbb603

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

bigframes/session/bq_caching_executor.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -524,23 +524,15 @@ def _substitute_large_local_sources(self, original_root: nodes.BigFrameNode):
524524
):
525525
needs_upload.append(leaf.local_data_source)
526526

527-
futures = []
527+
futures: dict[concurrent.futures.Future, local_data.ManagedArrowTable] = dict()
528528
for local_source in needs_upload:
529529
future = self.loader.read_data_async(
530530
local_source, bigframes.core.guid.generate_guid()
531531
)
532-
533-
def cache_result(
534-
future: concurrent.futures.Future,
535-
local: local_data.ManagedArrowTable = local_source,
536-
):
537-
self.cache.cache_remote_replacement(local, future.result())
538-
539-
future.add_done_callback(cache_result)
540-
futures.append(future)
532+
futures[future] = local_source
541533
try:
542-
for future in concurrent.futures.as_completed(futures):
543-
future.result()
534+
for future in concurrent.futures.as_completed(futures.keys()):
535+
self.cache.cache_remote_replacement(futures[future], future.result())
544536
except Exception as e:
545537
# cancel all futures
546538
for future in futures:

0 commit comments

Comments
 (0)