STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_compute_endpoints_offload Namespace Reference

Classes

class  _Recorded

Functions

Request _request (str email)
tuple[int, int|None] _drive (run_endpoint)
 test_evaluate_runs_off_the_event_loop (monkeypatch)
 test_timeseries_generate_runs_off_the_event_loop (monkeypatch)
 test_timeseries_from_segments_runs_off_the_event_loop (monkeypatch)
 test_a_sessions_solves_still_run_one_at_a_time ()
 _other_config ()
 test_a_config_written_during_evaluate_is_not_in_its_report (monkeypatch)
 test_a_config_written_during_a_blowdown_run_does_not_switch_its_runner (monkeypatch)
 test_set_config_swaps_config_and_runner_together (monkeypatch)
 _flight_arrays ()
 test_flight_simulate_runs_off_the_event_loop (monkeypatch)
 test_flight_optimize_altitude_runs_off_the_event_loop (monkeypatch)
 _meas ()
 _nav ()
 _thrust_cmd ()
 test_controller_solves_run_off_the_event_loop (monkeypatch, endpoint)
 test_controller_step_runs_off_the_event_loop ()

Detailed Description

The page-load solves must not run on the event loop.

Forward Mode evaluates every design it opens (POST /api/evaluate) and the
Time-Series tab runs it (POST /api/timeseries/generate, or /from-segments) --
about 10 s of CPU on a laptop and ~23 s on a CI runner. As ``async def``
endpoints calling the runner inline, that ran on the asyncio event loop and
froze every other request for as long: /api/health (a page opened meanwhile sat
on "Connecting"), the design bar's autosave, the documents API. The Playwright
suite failed on it on 2026-10-17 (design-persistence "panel state ... survives a
reload", and "Connected" timing out on connect-no-loop).

Same shape as test_config_endpoints_offload.py: the endpoint coroutines are
driven directly with asyncio.run, the solve is replaced by a spy that records the
thread it ran on, and the assertion is that it is NOT the event-loop thread.
Inline the call again and these fail. The spy raises once it has recorded, so
nothing here runs the physics.

Function Documentation

◆ _drive()

◆ _flight_arrays()

test_compute_endpoints_offload._flight_arrays ( )
protected

◆ _meas()

test_compute_endpoints_offload._meas ( )
protected

◆ _nav()

test_compute_endpoints_offload._nav ( )
protected

◆ _other_config()

test_compute_endpoints_offload._other_config ( )
protected

◆ _request()

◆ _thrust_cmd()

test_compute_endpoints_offload._thrust_cmd ( )
protected

◆ test_a_config_written_during_a_blowdown_run_does_not_switch_its_runner()

test_compute_endpoints_offload.test_a_config_written_during_a_blowdown_run_does_not_switch_its_runner ( monkeypatch)
The blowdown loop calls the engine every step; a mid-run edit must not split the burn.

Definition at line 200 of file test_compute_endpoints_offload.py.

References _other_config(), _request(), and main().

◆ test_a_config_written_during_evaluate_is_not_in_its_report()

test_compute_endpoints_offload.test_a_config_written_during_evaluate_is_not_in_its_report ( monkeypatch)
Forward Mode's report describes the design the numbers came from.

Definition at line 159 of file test_compute_endpoints_offload.py.

References _other_config(), _request(), and main().

◆ test_a_sessions_solves_still_run_one_at_a_time()

test_compute_endpoints_offload.test_a_sessions_solves_still_run_one_at_a_time ( )
Off the loop, two solves of one session must not share its runner at once.

Definition at line 122 of file test_compute_endpoints_offload.py.

References _request(), main(), and max.

◆ test_controller_solves_run_off_the_event_loop()

test_compute_endpoints_offload.test_controller_solves_run_off_the_event_loop ( monkeypatch,
endpoint )
Each builds the DDP controller (its engine wrapper) and, but for init, loops it.

Definition at line 337 of file test_compute_endpoints_offload.py.

References _drive(), _meas(), _nav(), and _thrust_cmd().

◆ test_controller_step_runs_off_the_event_loop()

test_compute_endpoints_offload.test_controller_step_runs_off_the_event_loop ( )

Definition at line 365 of file test_compute_endpoints_offload.py.

References _drive(), _meas(), _nav(), and _thrust_cmd().

◆ test_evaluate_runs_off_the_event_loop()

test_compute_endpoints_offload.test_evaluate_runs_off_the_event_loop ( monkeypatch)

Definition at line 71 of file test_compute_endpoints_offload.py.

References _drive().

◆ test_flight_optimize_altitude_runs_off_the_event_loop()

test_compute_endpoints_offload.test_flight_optimize_altitude_runs_off_the_event_loop ( monkeypatch)

Definition at line 303 of file test_compute_endpoints_offload.py.

References _drive(), and _flight_arrays().

◆ test_flight_simulate_runs_off_the_event_loop()

test_compute_endpoints_offload.test_flight_simulate_runs_off_the_event_loop ( monkeypatch)

Definition at line 291 of file test_compute_endpoints_offload.py.

References _drive(), and _flight_arrays().

◆ test_set_config_swaps_config_and_runner_together()

test_compute_endpoints_offload.test_set_config_swaps_config_and_runner_together ( monkeypatch)
While the new runner builds (seconds, for a CEA cache), a solve that starts takes the old pair.

Definition at line 246 of file test_compute_endpoints_offload.py.

◆ test_timeseries_from_segments_runs_off_the_event_loop()

test_compute_endpoints_offload.test_timeseries_from_segments_runs_off_the_event_loop ( monkeypatch)

Definition at line 106 of file test_compute_endpoints_offload.py.

References _drive().

◆ test_timeseries_generate_runs_off_the_event_loop()

test_compute_endpoints_offload.test_timeseries_generate_runs_off_the_event_loop ( monkeypatch)

Definition at line 87 of file test_compute_endpoints_offload.py.

References _drive().