INNER CODE UNIT · Python
limit_bytes
varunsalian/debrify · tool/webdav_memory_stress/run.py:131
limit_bytes = limit * 1024 * 1024
started = time.monotonic()
created = False
timed_out = False
try:
command(
"docker", "create", "--name", name,
"--memory", str(limit_bytes), "--memory-swap", str(limit_bytes),
"--cpus", "1", "--network", "none", "--pids-limit", "128",
image_id, *arguments, stdout=subprocess.DEVNULL,
)
created = True
# Compilation is outside this budget; the actual AOT process and its
# loopback HTTP server, file cache and runtime are inside it.
command("docker", "start", name, stdout=subprocess.DEVNULL)
try:
command("docker", "wait", name, stdout=subprocess.DEVNULL, timeout=timeout)
except subprocess.TimeoutExpired: