Cleanup of the TEA parity work: no prose in code, no hacks, everything in its place

1. No prose in code
- Remove parity-added Python comments and docstrings across the EEG, FHIR,
  execution, preview, training and run code and tests. Preserve endpoint
  descriptions as explicit FastAPI schema metadata.

2. No hacks, no glued code
- Read the declared TEA patient filters and training inputs directly and
  use the same TEA check for exposing and validating reference options.
- Give the Dagster GraphQL request one helper. Keep lock backoff and
  cancellation polling because their timing and error behavior are
  covered by run tests and they handle different Dagster states.
- Use the renamed FHIR report ID helper in the hospital test. Keep
  TEA_GATE_SLOW local to that test and preserve the test assertions.

3. Everything in its place
- Keep endpoint and run handling in WebApi and reuse Core and Persistance
  for domain rules and reads. Leave tests in the existing testpaths.
This commit is contained in:
2026-11-30 13:39:51 -06:00
parent 54b1995681
commit ec5d945f71
9 changed files with 62 additions and 82 deletions
+3 -8
View File
@@ -1,5 +1,3 @@
"""Concurrency and cancellation through the real API and Dagster daemon."""
import json
import time
from pathlib import Path
@@ -79,9 +77,9 @@ def test_cancelling_an_ingest_run_leaves_no_silver_or_gold(api, platform):
cancelled = _wait_cancelled(api, run_id)
assert cancelled["status"] == "CANCELED"
assert cancelled["error"] is None
with pytest.raises(DBAPIError): # the table was never created
with pytest.raises(DBAPIError):
platform.count("silver.person")
with pytest.raises(DBAPIError): # the table was never created
with pytest.raises(DBAPIError):
platform.count("gold.cacu_risk")
wait_for(api, _submit(api), 300)
@@ -92,8 +90,6 @@ def test_cancelling_an_ingest_run_leaves_no_silver_or_gold(api, platform):
def test_cancelling_a_queued_run_never_starts_it(api, platform):
load(api, "cacu")
runs = [_submit(api), _submit(api)]
# Dagster launches one of the two (its queue sorts by priority, not by submission order);
# the other waits behind the `writes` limit: cancel that one, whichever it is.
deadline = time.monotonic() + 120
while True:
states = {run_id: _get_run(api, run_id)["state"] for run_id in runs}
@@ -106,11 +102,10 @@ def test_cancelling_a_queued_run_never_starts_it(api, platform):
assert time.monotonic() < deadline, states
time.sleep(0.5)
ok(api.post(f"/runs/{queued[0]}/cancel"))
# Dagster stamps a start time on a queued run it cancels; what matters is that nothing ran
assert _wait_cancelled(api, queued[0])["steps"] == []
wait_for(api, running[0], 300)
@pytest.mark.skip(reason="needs killing the run worker; checked by hand")
def test_a_dead_run_does_not_stay_running():
"""The Dagster daemon detects a dead worker via `run_monitoring` in `dagster.yaml`."""
pass