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

1. No prose in code
- Remove parity-added comments and docstrings from TEA jobs, analysis and
  scoring helpers, execution, definitions, and tests. Keep base prose and
  Ruff and type-checker directives.

2. No hacks, no glued code
- Delegate both association cohort queries to persistance.eeg. Keep the
  predictor mapping and DataFrame shaping in the job, sharing biomarker
  codes and EEG study IDs with Core. Preserve column names and order, row
  selection, score filtering, and earliest fitting study.
- Use the existing MODELS registry for curve scoring in place of CURVES.
  Keep GOLD because the generic score job reads it.
- Catch lookup, database, and validation failures when loading a preview
  pipeline, preserving the existing warning. Keep execution-boundary
  exception handling for submitted tasks, telemetry and shutdown.
- Name the association test for the missing-champion case. Preserve its
  assertion and the other test assertions.

3. Everything in its place
- Keep SQL in Persistance, cohort shaping in models, and tests in their
  existing testpaths. Keep the association fits together with their
  shared design and result machinery.
This commit is contained in:
2026-11-30 13:39:51 -06:00
parent a818847b99
commit d8445fcabf
13 changed files with 60 additions and 217 deletions
+3 -12
View File
@@ -1,8 +1,3 @@
"""`execution.map` returns the same list in every mode, spreads lazy input without loading it
all, fails fast when the cluster is wrong, cleans up after a cancel, and reports progress on
the Dagster run. Remote tests need a scheduler: set `DASK_TEST_SCHEDULER` and
`DASK_EXPECTED_WORKERS` (the compose `test` profile does)."""
import json
import os
import signal
@@ -27,9 +22,6 @@ cloudpickle.register_pickle_by_value(sys.modules[__name__])
def by_value(fn):
"""Mark a worker function so that Dask ships its code, not its name: the scheduler
unpickles task graphs too, and has no test module (Dask wraps `fn` in a task, which
hides the by-value registration above from it)."""
fn.__module__ = "__main__"
return fn
@@ -178,10 +170,10 @@ def test_eta_smoothing_and_threshold():
eta = execution.Eta(alpha=0.3, min_done=3)
eta.update(0.0, 0)
eta.update(1.0, 2)
assert eta.eta_s(10) is None # fewer than 3 done
assert eta.eta_s(10) is None
eta.update(2.0, 4)
assert eta.eta_s(10) == pytest.approx((10 - 4) / 2.0)
eta.update(3.0, 8) # a faster burst: 4 items/s
eta.update(3.0, 8)
assert eta.rate == pytest.approx(0.3 * 4 + 0.7 * 2.0)
assert eta.eta_s(10) == pytest.approx(2 / eta.rate)
@@ -252,7 +244,6 @@ CANCEL_SCRIPT = textwrap.dedent(
def run_cancelled(mode, n):
"""Start a `map` of sleepers in a subprocess, send SIGTERM after its first line."""
proc = subprocess.Popen(
[sys.executable, "-c", CANCEL_SCRIPT.format(n=n, mode=mode)],
stdout=subprocess.PIPE,
@@ -260,7 +251,7 @@ def run_cancelled(mode, n):
env={**os.environ, "DASK_LOCAL_WORKERS": "2"},
)
assert proc.stdout.readline().startswith("working: 0/")
time.sleep(3) # the cluster is up and the tasks are submitted
time.sleep(3)
return proc