On this page

Phase scheduler knobs๏ƒ

๐ŸŸก Intermediate ยท Lesson 20

Conjure runs the compile pipeline (phases 1-11) through the PhaseScheduler - a worker pool with a barrier timeout. Two config knobs tune it: workers per spellbook and the barrier timeout. Slow CI boxes raise the timeout; tiny worlds run one worker.

Before you run๏ƒ

Use the Intermediate guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.

Run the saved script๏ƒ

python UX_and_AIX_experiences/02_intermediate/20_phase_scheduler_knobs.py
py -3.14t UX_and_AIX_experiences/02_intermediate/20_phase_scheduler_knobs.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

phase_scheduler_workers_per_spellbook, phase_scheduler_barrier_timeout_milliseconds

Code๏ƒ

 1"""
 2TIER: intermediate (20)
 3GOAL: Conjure runs the compile pipeline (phases 1-11) through the
 4      PhaseScheduler - a worker pool with a barrier timeout. Two config
 5      knobs tune it: workers per spellbook and the barrier timeout.
 6      Slow CI boxes raise the timeout; tiny worlds run one worker.
 7SURFACE EXERCISED: phase_scheduler_workers_per_spellbook,
 8                   phase_scheduler_barrier_timeout_milliseconds
 9"""
10import melder as md
11
12
13class Alpha:
14    pass
15
16
17class Beta:
18    def __init__(self, alpha: Alpha) -> None:
19        self.alpha = alpha
20
21
22def main() -> None:
23    configuration = md.SpellbookConfiguration()
24    configuration.with_defaults()
25    configuration.set_property("phase_scheduler_workers_per_spellbook", 1)
26    configuration.set_property(
27        "phase_scheduler_barrier_timeout_milliseconds", 30_000
28    )
29
30    book = md.Spellbook(configuration=configuration)
31    book.bind(spell=Alpha, existence="unique")
32    book.bind(spell=Beta, existence="unique")
33    conduit = book.conjure()  # phases run under the tuned scheduler
34
35    beta = conduit.meld(spell=Beta)
36    assert isinstance(beta.alpha, Alpha)
37    print("compiled on one worker with a generous barrier; DI intact")
38    print("if conjure ever raises PhaseTimeoutError, this timeout knob is why")
39
40
41if __name__ == "__main__":
42    main()

Check the outcome๏ƒ

The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.

More intermediate examples ยท Level guide