File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import threading
1717import uuid
1818import warnings
19+ from concurrent .futures import ThreadPoolExecutor
1920from typing import List , Optional , Sequence
2021
2122import google .cloud .bigquery as bigquery
@@ -170,9 +171,19 @@ def _cleanup_old_udfs(self):
170171
171172 def close (self ):
172173 """Delete tables that were created with this session's session_id."""
173- for table_ref in self ._table_ids :
174- self .bqclient .delete_table (table_ref , not_found_ok = True )
175- self ._table_ids .clear ()
174+ if self ._table_ids :
175+ try :
176+ with ThreadPoolExecutor () as executor :
177+ futures = [
178+ executor .submit (
179+ self .bqclient .delete_table , table_ref , not_found_ok = True
180+ )
181+ for table_ref in self ._table_ids
182+ ]
183+ for future in futures :
184+ future .result ()
185+ finally :
186+ self ._table_ids .clear ()
176187
177188 try :
178189 # Before closing the session, attempt to clean up any uncollected,
Original file line number Diff line number Diff line change @@ -354,6 +354,7 @@ def run_system(
354354 "py.test" ,
355355 "-v" ,
356356 f"-n={ num_workers } " ,
357+ "--dist=worksteal" ,
357358 # Any individual test taking longer than 15 mins will be terminated.
358359 f"--timeout={ timeout_seconds } " ,
359360 # Log 20 slowest tests
You can’t perform that action at this time.
0 commit comments