Skip to content

Commit 42c890c

Browse files
committed
debug: fine-grained cell logging (exec/done/figs)
1 parent 0b2bb58 commit 42c890c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/render_notebooks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def _patched_show(*_args, **_kwargs) -> None:
8282
if not src:
8383
continue
8484

85+
preview = src.splitlines()[0][:55]
86+
print(f" [cell {exec_count} exec ] {preview}", file=sys.__stdout__, flush=True)
87+
8588
cell_images.clear()
8689
stdout_buf = io.StringIO()
8790

@@ -100,6 +103,8 @@ def _patched_show(*_args, **_kwargs) -> None:
100103
finally:
101104
sys.stdout = sys.__stdout__
102105

106+
print(f" [cell {exec_count} done ]", file=sys.__stdout__, flush=True)
107+
103108
if not plt_ref and "plt" in ns:
104109
plt_ref.append(ns["plt"])
105110
plt_ref[0].show = _patched_show
@@ -111,7 +116,9 @@ def _patched_show(*_args, **_kwargs) -> None:
111116
)
112117

113118
if plt_ref:
119+
print(f" [cell {exec_count} figs ]", file=sys.__stdout__, flush=True)
114120
cell_images.extend(_capture_and_close(plt_ref[0]))
121+
print(f" [cell {exec_count} figs done]", file=sys.__stdout__, flush=True)
115122

116123
for img_b64 in cell_images:
117124
cell.outputs.append(

0 commit comments

Comments
 (0)