Skip to content

Commit 5cd9f0b

Browse files
committed
add additional logging for populate1
1 parent f341d54 commit 5cd9f0b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

datajoint/autopopulate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def populate(
158158
max_calls=None,
159159
display_progress=False,
160160
processes=1,
161-
make_kwargs=None
161+
make_kwargs=None,
162162
):
163163
"""
164164
``table.populate()`` calls ``table.make(key)`` for every primary key in
@@ -275,7 +275,7 @@ def _populate1(
275275
if jobs is not None:
276276
jobs.complete(self.target.table_name, self._job_key(key))
277277
else:
278-
logger.debug("Populating: " + str(key))
278+
logger.debug(f"Making {key} -> {self.target.table_name} ")
279279
self.__class__._allow_insert = True
280280
try:
281281
make(dict(key), **(make_kwargs or {}))
@@ -288,6 +288,9 @@ def _populate1(
288288
exception=error.__class__.__name__,
289289
msg=": " + str(error) if str(error) else "",
290290
)
291+
logger.debug(
292+
f"Error making {key} -> {self.target.table_name} - {error_message}"
293+
)
291294
if jobs is not None:
292295
# show error name and error message (if any)
293296
jobs.error(
@@ -303,6 +306,7 @@ def _populate1(
303306
return key, error if return_exception_objects else error_message
304307
else:
305308
self.connection.commit_transaction()
309+
logger.debug(f"Success making {key} -> {self.target.table_name}")
306310
if jobs is not None:
307311
jobs.complete(self.target.table_name, self._job_key(key))
308312
finally:

datajoint/logging.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
log_level = os.getenv("DJ_LOG_LEVEL", "info").upper()
99

10-
log_format = logging.Formatter(
11-
"[%(asctime)s][%(levelname)s]: %(message)s"
12-
)
10+
log_format = logging.Formatter("[%(asctime)s][%(levelname)s]: %(message)s")
1311

1412
stream_handler = logging.StreamHandler() # default handler
1513
stream_handler.setFormatter(log_format)

0 commit comments

Comments
 (0)