The file efa_stats.py in your workspace implements a parser and aggregator
for EFA bandwidth test output. Each process in the original health check
prints transfer rows; only the row whose first field starts with the chosen
mb_per_write digit holds the unidirectional MB/s in column 4. The aggregator
doubles each per-process value (unidirectional → bidirectional) and converts
to GB/s, rounding to two decimals.
In production this aggregation runs across many parallel NIC processes on each
cluster node; results must be combined into one report per benchmark run.
Your Task
Create /app/solution/modal_app.py that:
Defines a module-level app.
Exposes a Modal Function that parses one process's text output and returns
its bidirectional MB/s (the per-shard worker).
Exposes run_case(case) so that the verifier sees the same aggregate
report as the original: a dict with per_process_mb, total_mb,
total_gbps, num_processes, and num_contributing.
Case dict: {"mb_per_write": int, "outputs": list[str]}. Treat each entry
in outputs as one parallel process's raw text. The list is independent
per element; the entrypoint should fan the per-process parse work out and
then reduce locally.
Capability contract
Implement run_case as a local orchestrator: a plain Python function (not itself a Modal Function) that the harness calls directly and that dispatches work to one or more Modal Functions via .remote(...), .map(...), or .starmap(...).
The solution must also use:
Fan-out.
Staged helpers.
Output file
Write your solution to /app/solution/modal_app.py.