Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
957 B
Python
29 lines
957 B
Python
"""Hidden stress simulation: python3 stress.py WORKSPACE a|b -> one JSON line.
|
|
|
|
WORKSPACE is a private copy whose sched/sim.py has been replaced by the pristine simulator.
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
import time
|
|
|
|
sys.path.insert(0, sys.argv[1])
|
|
sys.dont_write_bytecode = True
|
|
|
|
from sched.sim import Sim, SimConfig # noqa: E402
|
|
|
|
CONFIGS = {
|
|
# three workers, one of them for exports; ids wrap about 34 times
|
|
"a": dict(jobs=140000, seed=11, workers=3, slow_workers=1, rate=1.0, export_prob=1 / 6000),
|
|
# five workers, two for exports, busier traffic and a different seed
|
|
"b": dict(jobs=100000, seed=29, workers=5, slow_workers=2, rate=1.8, export_prob=1 / 4000),
|
|
}
|
|
|
|
if __name__ == "__main__":
|
|
cfg = SimConfig(**CONFIGS[sys.argv[2]])
|
|
started = time.time()
|
|
summary = Sim(cfg).run()
|
|
summary["configured_jobs"] = cfg.jobs
|
|
summary["wall_seconds"] = round(time.time() - started, 1)
|
|
print(json.dumps(summary, sort_keys=True))
|