Skip to content

Commit 68300f2

Browse files
Merge pull request #1349 from datajoint/perf/lazy-load-autopopulate
refactor: code organization and lazy imports for better modularity
2 parents a8b0734 + 86f5936 commit 68300f2

File tree

11 files changed

+1335
-1295
lines changed

11 files changed

+1335
-1295
lines changed

src/datajoint/autopopulate.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import traceback
1212
from typing import TYPE_CHECKING, Any, Generator
1313

14-
import deepdiff
15-
from tqdm import tqdm
16-
1714
from .errors import DataJointError, LostConnectionError
1815
from .expression import AndList, QueryExpression
1916

@@ -401,6 +398,8 @@ def _populate_direct(
401398
Computes keys directly from key_source, suitable for single-worker
402399
execution, development, and debugging.
403400
"""
401+
from tqdm import tqdm
402+
404403
keys = (self._jobs_to_do(restrictions) - self).keys()
405404

406405
logger.debug("Found %d keys to populate" % len(keys))
@@ -473,6 +472,8 @@ def _populate_distributed(
473472
Uses job table for multi-worker coordination, priority scheduling,
474473
and status tracking.
475474
"""
475+
from tqdm import tqdm
476+
476477
from .settings import config
477478

478479
# Define a signal handler for SIGTERM
@@ -581,6 +582,8 @@ def _populate1(
581582
"""
582583
import time
583584

585+
import deepdiff
586+
584587
# use the legacy `_make_tuples` callback.
585588
make = self._make_tuples if hasattr(self, "_make_tuples") else self.make
586589

0 commit comments

Comments
 (0)