Skip to content

Commit 3d7c4ea

Browse files
authored
fix: update job metadata in the make's transaction
1 parent 269c4af commit 3d7c4ea

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

datajoint/autopopulate.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,16 +470,9 @@ def _populate1(
470470
logger.error(error)
471471
return key, error if return_exception_objects else error_message
472472
else:
473-
self.connection.commit_transaction()
474-
self._Jobs.complete(
475-
self.target.table_name,
476-
self._job_key(key),
477-
run_duration=(datetime.datetime.utcnow() - make_start).total_seconds(),
478-
)
479473
# Update the _job column with the job metadata for newly populated entries
480474
if "_job" in self.target.heading._attributes:
481475
job_metadata = {
482-
"execution_time": make_start,
483476
"execution_duration": (
484477
datetime.datetime.utcnow() - make_start
485478
).total_seconds(),
@@ -490,7 +483,12 @@ def _populate1(
490483
}
491484
for k in (self.target & key).fetch("KEY"):
492485
self.target.update1({**k, "_job": job_metadata})
493-
486+
self.connection.commit_transaction()
487+
self._Jobs.complete(
488+
self.target.table_name,
489+
self._job_key(key),
490+
run_duration=(datetime.datetime.utcnow() - make_start).total_seconds(),
491+
)
494492
logger.debug(f"Success making {key} -> {self.target.full_table_name}")
495493
return True
496494
finally:

0 commit comments

Comments
 (0)