Skip to content

Commit 3956817

Browse files
fix: Disable semantic_check for job table subtraction in refresh()
The `-` operator calls `.restrict(Not(x))` without passing `semantic_check=False`. When `keep_completed=True`, the subtraction `- self._target` fails because: - Job table's PK has lineage `~~table.attr` (defined in job table) - Target table's PK has lineage `#parent.attr` (from foreign key) Replace `-` operator with explicit `.restrict(Not(...), semantic_check=False)`. Also move `Not` import to top-level (was local import). Fixes #1379 Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 39f4aa7 commit 3956817

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/datajoint/jobs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import platform
1414
import subprocess
1515

16-
from .condition import AndList
16+
from .condition import AndList, Not
1717
from .errors import DataJointError, DuplicateError
1818
from .heading import Heading
1919
from .table import Table
@@ -370,8 +370,6 @@ def refresh(
370370

371371
# Keys that need jobs: in key_source, not in target, not in jobs
372372
# Disable semantic_check for Job table (self) because its attributes may not have matching lineage
373-
from .condition import Not
374-
375373
new_keys = (key_source - self._target).restrict(Not(self), semantic_check=False).proj()
376374
new_key_list = new_keys.keys()
377375

@@ -395,8 +393,10 @@ def refresh(
395393
# 2. Re-pend success jobs if keep_completed=True
396394
if config.jobs.keep_completed:
397395
# Success jobs whose keys are in key_source but not in target
398-
# Disable semantic_check for Job table operations
399-
success_to_repend = self.completed.restrict(key_source, semantic_check=False) - self._target
396+
# Disable semantic_check for Job table operations (job table PK has different lineage than target)
397+
success_to_repend = self.completed.restrict(key_source, semantic_check=False).restrict(
398+
Not(self._target), semantic_check=False
399+
)
400400
repend_keys = success_to_repend.keys()
401401
for key in repend_keys:
402402
(self & key).delete_quick()

0 commit comments

Comments
 (0)