OCR only on the pages without text; otherwise routes; batches on Dask through its own API

This commit is contained in:
Roberto Treviño
2026-11-27 19:17:49 -06:00
parent 385cc5b80b
commit 0c78f8cf7d
5 changed files with 82 additions and 45 deletions
+2 -4
View File
@@ -11,7 +11,6 @@ from the valid studies.
from pathlib import Path
import pandas as pd
from joblib import Parallel, delayed
from models import cluster
from models.tea.eeg.analysis import analyze
@@ -48,9 +47,8 @@ def _one(key: str, edf: bytes, age: float) -> dict:
def measure(studies) -> list[dict]:
"""Each study's verdict and features, in listing order, each a task on the cluster
(models.cluster)."""
with cluster.batch(): # each task carries its recording: workers see no local folder
return Parallel(n_jobs=cluster.jobs())(delayed(_one)(key, Path(path).read_bytes(), age)
for key, path, age in studies) # fmt: skip
# each task carries its recording: workers see no local folder
return cluster.run(_one, ((key, Path(path).read_bytes(), age) for key, path, age in studies))
def tables(measured: list[dict]) -> dict[str, pd.DataFrame]: