Skip to content

Commit fcd89d8

Browse files
authored
Revert "fix: Initialize ThreadPoolExecutor in sql registry (#210)"
This reverts commit 7274460.
1 parent 7274460 commit fcd89d8

File tree

1 file changed

+7
-24
lines changed
  • sdk/python/feast/infra/registry

1 file changed

+7
-24
lines changed

sdk/python/feast/infra/registry/sql.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import atexit
21
import logging
3-
import threading
42
import uuid
53
from concurrent.futures import ThreadPoolExecutor
64
from datetime import datetime, timezone
@@ -287,11 +285,6 @@ def __init__(
287285
self.thread_pool_executor_worker_count = (
288286
registry_config.thread_pool_executor_worker_count
289287
)
290-
if self.thread_pool_executor_worker_count > 0:
291-
self._executor = ThreadPoolExecutor(
292-
max_workers=self.thread_pool_executor_worker_count
293-
)
294-
atexit.register(self._exit_handler)
295288
self.purge_feast_metadata = registry_config.purge_feast_metadata
296289
# Sync feast_metadata to projects table
297290
# when purge_feast_metadata is set to True, Delete data from
@@ -990,17 +983,14 @@ def process_project(project: Project):
990983
r.infra.CopyFrom(self.get_infra(project_name).to_proto())
991984

992985
projects_list = self.list_projects(allow_cache=False)
993-
if self._executor:
994-
logger.info(
995-
f"Thread count before executor.map: {len(threading.enumerate())}"
996-
)
997-
self._executor.map(process_project, projects_list)
998-
logger.info(
999-
f"Thread count after executor.map: {len(threading.enumerate())}"
1000-
)
986+
if self.thread_pool_executor_worker_count == 0:
987+
for project in projects_list:
988+
process_project(project)
1001989
else:
1002-
for p in projects_list:
1003-
process_project(p)
990+
with ThreadPoolExecutor(
991+
max_workers=self.thread_pool_executor_worker_count
992+
) as executor:
993+
executor.map(process_project, projects_list)
1004994

1005995
if last_updated_timestamps:
1006996
r.last_updated.FromDatetime(max(last_updated_timestamps))
@@ -1427,10 +1417,3 @@ def get_project_metadata(
14271417
datetime.utcfromtimestamp(int(metadata_value))
14281418
)
14291419
return project_metadata_model
1430-
1431-
def _exit_handler(self):
1432-
if self._executor:
1433-
logger.info("Shutting down SqlRegistry's ThreadPoolExecutor...")
1434-
self._executor.shutdown(wait=False, cancel_futures=True)
1435-
logger.info("ThreadPoolExecutor shut down successfully.")
1436-
self._executor = None

0 commit comments

Comments
 (0)