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:
@@ -15,7 +15,6 @@ def test_centile_interpolation_preserves_scoring():
|
||||
"p95": [7, 9],
|
||||
},
|
||||
}
|
||||
# At the geometric midpoint, the original log-age interpolation gives the means.
|
||||
assert curves.centiles(baseline, 24) == pytest.approx(
|
||||
{"p5": 2, "p25": 3, "median": 4, "p75": 6, "p95": 8}
|
||||
)
|
||||
|
||||
+3
-12
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"""The association fit and its parity with the pinned tea-lib source."""
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -40,7 +38,6 @@ def test_ordinal_on_monotone_trend():
|
||||
def test_pairs_and_item_availability():
|
||||
assert len(a.pairs("item")) == 41
|
||||
assert len(a.pairs("domain")) == 15
|
||||
# Item order in the source, translated by meaning into the platform catalog names.
|
||||
assert ADOS2_ITEMS == [
|
||||
"vocalization_directed", "pointing", "gestures", "unusual_eye_contact",
|
||||
"facial_expressions", "gaze_integration", "shared_enjoyment", "response_to_name",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"""The tea_eeg job's graph, sensor, config classes and synthetic EEG scope."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
@@ -115,7 +113,6 @@ def test_config_mirrors_match_the_shared_models():
|
||||
assert list(config.model_fields) == list(shared.model_fields)
|
||||
for name, field in shared.model_fields.items():
|
||||
assert config.model_fields[name].default == field.default, name
|
||||
# a wrong value still reaches the shared model's validation
|
||||
with pytest.raises(ValidationError):
|
||||
ExecutionConfig(mode="cloud").model()
|
||||
with pytest.raises(ValidationError):
|
||||
@@ -140,7 +137,7 @@ def test_definitions_load_with_every_job_and_the_sensor():
|
||||
assert tea_eeg_after_ingest.default_status == dg.DefaultSensorStatus.RUNNING
|
||||
|
||||
|
||||
def test_relate_is_a_no_op_until_phase_2():
|
||||
def test_relate_returns_none_without_a_champion():
|
||||
assert tea_jobs.relate() is None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user