HassamGani commited on
Commit
dd7b49d
·
1 Parent(s): 7ef0426

Families package; queues draw three stories

Browse files
reorgbench/gen/__init__.py CHANGED
@@ -14,6 +14,7 @@ from functools import lru_cache
14
  from ..tasks.spec import Task
15
  from .build import GenerationError, Knobs, build, calibrate
16
  from .templates import TEMPLATES, Template, register_template
 
17
 
18
  PUBLIC_SEEDS = 70
19
  QUEUE_SEEDS = 30 # ops-queue tasks in the public train split: every public story at once in one company
 
14
  from ..tasks.spec import Task
15
  from .build import GenerationError, Knobs, build, calibrate
16
  from .templates import TEMPLATES, Template, register_template
17
+ from . import families # noqa: F401 (registers the other public families)
18
 
19
  PUBLIC_SEEDS = 70
20
  QUEUE_SEEDS = 30 # ops-queue tasks in the public train split: every public story at once in one company
reorgbench/gen/families/__init__.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ """More scenario families, one module each. A module registers its template on import."""
2
+
3
+ from importlib import import_module
4
+ from importlib.util import find_spec
5
+
6
+ for _name in ("sla_credit", "price_increase", "data_retention"):
7
+ if find_spec(f"{__name__}.{_name}") is not None:
8
+ import_module(f"{__name__}.{_name}")
reorgbench/gen/queue.py CHANGED
@@ -87,11 +87,10 @@ def _merge_staffing(main: list[list[str]], side: Counter) -> list[list[str]]:
87
 
88
 
89
  def sample(seed: int) -> list[tuple[Template, Knobs]]:
90
- """Every public story once, in a seeded order. The first is the job the person changes; the side jobs are
91
  smaller and fixed."""
92
  rng = random.Random(f"{QUEUE_ID}:{seed}:knobs")
93
- order = [t for t in TEMPLATES.values() if t.split == "train"]
94
- rng.shuffle(order)
95
  main, *side = order
96
  k = main.sample(rng)
97
  while not k.messy: # the job that changes is a hard one
 
87
 
88
 
89
  def sample(seed: int) -> list[tuple[Template, Knobs]]:
90
+ """Three public stories, in a seeded order. The first is the job the person changes; the side jobs are
91
  smaller and fixed."""
92
  rng = random.Random(f"{QUEUE_ID}:{seed}:knobs")
93
+ order = rng.sample(sorted((t for t in TEMPLATES.values() if t.split == "train"), key=lambda t: t.id), 3)
 
94
  main, *side = order
95
  k = main.sample(rng)
96
  while not k.messy: # the job that changes is a hard one