File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,20 @@ def reset_seeds(gallery_conf, fname):
165
165
pass
166
166
167
167
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
+
168
182
sphinx_gallery_conf = {
169
183
"examples_dirs" : [
170
184
"beginner_source" ,
@@ -182,7 +196,7 @@ def reset_seeds(gallery_conf, fname):
182
196
"# https://pytorch.org/tutorials/beginner/colab\n "
183
197
"%matplotlib inline"
184
198
),
185
- "reset_modules" : (reset_seeds ),
199
+ "reset_modules" : (reset_seeds , kill_procs ),
186
200
"ignore_pattern" : r"_torch_export_nightly_tutorial.py" ,
187
201
"pypandoc" : {
188
202
"extra_args" : ["--mathjax" , "--toc" ],
You can’t perform that action at this time.
0 commit comments