Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/bigframes/bigframes/session/anonymous_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import threading
import uuid
import warnings
from concurrent.futures import ThreadPoolExecutor
from typing import List, Optional, Sequence

import google.cloud.bigquery as bigquery
Expand Down Expand Up @@ -170,9 +171,19 @@ def _cleanup_old_udfs(self):

def close(self):
"""Delete tables that were created with this session's session_id."""
for table_ref in self._table_ids:
self.bqclient.delete_table(table_ref, not_found_ok=True)
self._table_ids.clear()
if self._table_ids:
try:
with ThreadPoolExecutor() as executor:
futures = [
executor.submit(
self.bqclient.delete_table, table_ref, not_found_ok=True
)
for table_ref in self._table_ids
]
for future in futures:
future.result()
finally:
self._table_ids.clear()

try:
# Before closing the session, attempt to clean up any uncollected,
Expand Down
1 change: 1 addition & 0 deletions packages/bigframes/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def run_system(
"py.test",
"-v",
f"-n={num_workers}",
"--dist=worksteal",
# Any individual test taking longer than 15 mins will be terminated.
f"--timeout={timeout_seconds}",
# Log 20 slowest tests
Expand Down
Loading