Automático: draw-only option; end-to-end test covers biopsies, treatments and deaths
This commit is contained in:
@@ -9,6 +9,8 @@ import json
|
||||
from test_conectar import ok, wait_for
|
||||
|
||||
SOURCE = "resultados"
|
||||
# Studies whose every record the operator's drawing places, the draft must place too.
|
||||
DRAWN = ("cervical_cytology", "mammography", "cervical_biopsy", "breast_biopsy")
|
||||
HOURS = 3600 # with a model answering, it reads every document: an hour or more per run
|
||||
|
||||
|
||||
@@ -39,7 +41,8 @@ def test_automatico_drafts_a_sites_pipeline_and_runs_it(api, platform, site):
|
||||
kinds = [n["kind"] for n in saved["pipeline"]["nodes"]]
|
||||
assert {"read", "route", "extract", "link", "target"} <= set(kinds)
|
||||
studies = {n["entity"] for n in saved["pipeline"]["nodes"] if n["kind"] == "target"}
|
||||
assert {"cervical_cytology", "mammography"} <= studies, studies
|
||||
# One layout may report several studies: pathology by organ, notes by what they record.
|
||||
assert set(DRAWN) | {"breast_treatment", "death"} <= studies, studies
|
||||
# Documents no route claims wait for a reviewer, as with a drawn pipeline.
|
||||
assert any(n.get("otherwise") for n in saved["pipeline"]["nodes"])
|
||||
|
||||
@@ -51,7 +54,7 @@ def test_automatico_drafts_a_sites_pipeline_and_runs_it(api, platform, site):
|
||||
both = set(mine) & set(theirs)
|
||||
differ = {k: (mine[k], theirs[k]) for k in both if str(mine[k]) != str(theirs[k])}
|
||||
assert both and not differ, differ
|
||||
for study in ("cervical_cytology", "mammography"):
|
||||
for study in DRAWN:
|
||||
drawn_records = {r for s, r, _ in theirs if s == study}
|
||||
assert drawn_records <= {r for s, r, _ in mine if s == study}, study
|
||||
|
||||
|
||||
+4
-4
@@ -156,11 +156,11 @@ def language_model() -> LanguageModel:
|
||||
|
||||
@router.post("/pipelines/{pipeline_id}/draft")
|
||||
def start_draft(
|
||||
pipeline_id: PipelineId, client: DagsterGraphQLClient = Depends(dagster)
|
||||
pipeline_id: PipelineId, run: bool = True, client: DagsterGraphQLClient = Depends(dagster)
|
||||
) -> dict[str, str]:
|
||||
"""Automático: starts the `draft` job, which draws the whole pipeline from its saved
|
||||
sources (the only nodes it may hold), saves it as a new version and runs it; follow it
|
||||
at /runs/{run_id}."""
|
||||
sources (the only nodes it may hold), saves it as a new version and runs it (`run`
|
||||
false: drawn and saved only); follow it at /runs/{run_id}."""
|
||||
if not config_log.latest_version(pipeline_id):
|
||||
raise HTTPException(404, detail=f"no pipeline {pipeline_id}")
|
||||
_, saved = config_log.get(pipeline_id)
|
||||
@@ -169,7 +169,7 @@ def start_draft(
|
||||
"fuentes: guárdela solo con ellas.") # fmt: skip
|
||||
if not (found := llm.status())["available"]:
|
||||
raise HTTPException(503, detail=f"El modelo de lenguaje no responde: {found['reason']}")
|
||||
config = {"ops": {"draft_pipeline": {"config": {"pipeline": pipeline_id}}}}
|
||||
config = {"ops": {"draft_pipeline": {"config": {"pipeline": pipeline_id, "run": run}}}}
|
||||
try:
|
||||
return {"run_id": client.submit_job_execution("draft", run_config=config)}
|
||||
except DagsterGraphQLClientError as e:
|
||||
|
||||
Reference in New Issue
Block a user