Skip to content

Commit 2790aa0

Browse files
author
Thinh Nguyen
committed
exclude error or ignore keys for populate with reserve_jobs
1 parent a745322 commit 2790aa0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

datajoint/autopopulate.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import random
66
import inspect
77
from tqdm import tqdm
8+
from .hash import key_hash
89
from .expression import QueryExpression, AndList
910
from .errors import DataJointError, LostConnectionError
1011
import signal
@@ -202,6 +203,16 @@ def handler(signum, frame):
202203
old_handler = signal.signal(signal.SIGTERM, handler)
203204

204205
keys = (self._jobs_to_do(restrictions) - self.target).fetch("KEY", limit=limit)
206+
207+
# exclude "error" or "ignore" jobs
208+
if reserve_jobs:
209+
exclude_key_hashes = (
210+
jobs
211+
& {"table_name": self.target.table_name}
212+
& 'status in ("error", "ignore")'
213+
).fetch("key_hash")
214+
keys = [key for key in keys if key_hash(key) not in exclude_key_hashes]
215+
205216
if order == "reverse":
206217
keys.reverse()
207218
elif order == "random":

0 commit comments

Comments
 (0)