Skip to content

Commit efbb920

Browse files
committed
feat: insert _job metadata upon make completion
1 parent 18727e9 commit efbb920

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

datajoint/autopopulate.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,18 @@ def _populate1(
477477
datetime.datetime.utcnow() - make_start
478478
).total_seconds(),
479479
)
480+
# Update the _job column with the job metadata for newly populated entries
481+
if "_job" in self.target.heading._attributes:
482+
job_metadata = {
483+
"execution_time": make_start,
484+
"execution_duration": (datetime.datetime.utcnow() - make_start).total_seconds(),
485+
"host": platform.node(),
486+
"pid": os.getpid(),
487+
"connection_id": self.connection.connection_id,
488+
"user": self._Jobs._user,
489+
}
490+
for k in (self.target & key).fetch("KEY"):
491+
self.target.update1({**k, "_job": job_metadata})
480492

481493
logger.debug(f"Success making {key} -> {self.target.full_table_name}")
482494
return True

0 commit comments

Comments
 (0)