tractor/examples/parallelism
Gud Boi 95a2b18267 Make sub-spawn strategy toggleable in `we_are_processes`
The #470 boot-latency example hard-coded spawning each `worker_<i>`
subactor concurrently from a bg `trio.Task` (so each child's cold
`import tractor` overlaps). Add a `main()` `spawn_subs_in_bg_tasks`
flag so the serial-spawn path can be demo'd/compared too: flip it
`False` to `start_actor()` each sub inline in the loop before
handing the ready `Portal` to the bg task.

Deats,
- factor an `open_ep(ptl, i)` helper out of `spawn_and_open_ep()` -
  just the `Portal.open_context()` + `wait_for_result()` half, now
  that the spawn step is caller-optional.
- `spawn_and_open_ep()` grows a `maybe_ptl: Portal|None = None`
  param: spawn the subactor itself when unset (bg-task path), OW
  reuse the pre-spawned one (serial path).
- move the "overlap cold imports" rationale comment onto the new
  `main()` param where the toggle now lives.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-07-02 22:17:25 -04:00
..
concurrent_actors_primes.py Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
concurrent_futures_primes.py Un-hide stdlib primes example, add `trio` shim 2026-06-28 13:29:01 -04:00
single_func.py Use `.wait_for_result()` in dated examples 2026-06-28 13:29:01 -04:00
we_are_processes.py Make sub-spawn strategy toggleable in `we_are_processes` 2026-07-02 22:17:25 -04:00