MCPcopy Create free account
hub / github.com/anyoptimization/pymoo / jcache_execute

Function jcache_execute

docs/cli.py:186–206  ·  view source on GitHub ↗

Execute outdated notebooks in parallel, capped at EXEC_JOBS workers. jupyter-cache's parallel pool sizes itself from os.cpu_count() with no CLI knob, so we run jcache in a shim that patches cpu_count — keeping load sane on small machines.

(force=False)

Source from the content-addressed store, hash-verified

184
185
186def jcache_execute(force=False):
187 """Execute outdated notebooks in parallel, capped at EXEC_JOBS workers.
188
189 jupyter-cache's parallel pool sizes itself from os.cpu_count() with no CLI
190 knob, so we run jcache in a shim that patches cpu_count — keeping load sane
191 on small machines.
192 """
193 shim = (
194 f"import os; os.cpu_count = lambda: {int(EXEC_JOBS)}; "
195 "from jupyter_cache.cli.commands.cmd_main import jcache; jcache()"
196 )
197 cmd = [sys.executable, "-c", shim, "project", "execute",
198 "--executor", "local-parallel", "--timeout", EXEC_TIMEOUT]
199 if force:
200 cmd.append("--force")
201 print(f"⚡ Executing {'ALL' if force else 'outdated'} notebooks "
202 f"({EXEC_JOBS} parallel, {EXEC_TIMEOUT}s/cell timeout)...")
203 result = subprocess.run(cmd, input="y\n", text=True, check=False)
204 if result.returncode != 0:
205 sys.exit(result.returncode)
206 return result
207
208
209def clean_docs():

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
runMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…