Skip to content

Commit e8c4e17

Browse files
committed
Update
1 parent 2414a2d commit e8c4e17

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

conf.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@ def reset_seeds(gallery_conf, fname):
165165
pass
166166

167167

168+
def kill_procs(gallery_conf, fname):
169+
import os
170+
171+
import psutil
172+
173+
# Get the current process
174+
current_proc = psutil.Process(os.getpid())
175+
# Iterate over all child processes
176+
for child in current_proc.children(recursive=True):
177+
# Kill the child process
178+
child.terminate()
179+
print(f"Killed child process with PID {child.pid}")
180+
181+
168182
sphinx_gallery_conf = {
169183
"examples_dirs": [
170184
"beginner_source",
@@ -182,7 +196,7 @@ def reset_seeds(gallery_conf, fname):
182196
"# https://pytorch.org/tutorials/beginner/colab\n"
183197
"%matplotlib inline"
184198
),
185-
"reset_modules": (reset_seeds),
199+
"reset_modules": (reset_seeds, kill_procs),
186200
"ignore_pattern": r"_torch_export_nightly_tutorial.py",
187201
"pypandoc": {
188202
"extra_args": ["--mathjax", "--toc"],

0 commit comments

Comments
 (0)