Skip to content

Commit f9a89f0

Browse files
fix: apply restrictions to pending_query in _populate_distributed
Fixes #1413 — populate() with reserve_jobs=True was ignoring restrictions passed by the caller. _populate_distributed() refreshed the job queue with the correct restrictions but then fetched all pending keys without filtering them. The fix intersects the pending query with _jobs_to_do(restrictions), matching the behaviour of _populate_direct(). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 34acbbe commit f9a89f0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/datajoint/autopopulate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ def handler(signum, frame):
493493

494494
# Fetch pending jobs ordered by priority (use CURRENT_TIMESTAMP(3) for datetime(3) precision)
495495
pending_query = self.jobs.pending & "scheduled_time <= CURRENT_TIMESTAMP(3)"
496+
if restrictions:
497+
pending_query = pending_query & self._jobs_to_do(restrictions)
496498
if priority is not None:
497499
pending_query = pending_query & f"priority <= {priority}"
498500

0 commit comments

Comments
 (0)