Repository navigation
Fixes #19481: Record OpenLineage pipeline run status and tasks - #37990
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
The Executions tab stayed empty for OpenLineage pipelines because the connector never wrote run status. Each run gets one row keyed by the time in its UUIDv7 runId, so events read in any order or by another ingestion find the same row. A failed job fails the run, and a status never moves back to an earlier state. FAIL and ABORT events list the datasets a job meant to read and write, so they update status only, not lineage. Fixes #19481 Fixes #19321
- Drop the run's own task line: only steps are tasks - Give each step try its own line, keyed by its runId (taskId); a failed Airflow task leaves the outcome to its DAG run, so a retry that succeeds no longer fails the run - Open the row on any event, so steps read before the run's START are kept - Give a run whose runId shares a millisecond with another run (an Airflow rerun after clear) the next free key instead of dropping it - Make jobType APPLICATION, DAG and JOB runs their own pipelines, and link the pipeline whose task started one to it - Keep the error of the failure that still stands - Record both rules in docs/decisions Refs #19481
- Tasks view reads a task's status from its latest try: the server returns a run's lines oldest first, so a retried task that succeeded showed its first, failed try - Keep the run's error once it has failed: a same-named Spark SQL job, or an Airflow retry read late, no longer clears it - Find a launching DAG pipeline this ingestion wrote by FQN, as the search index may not hold it yet and an empty search stays cached Refs #19481
The run row holds one error. When a later try of the blamed step succeeds, name the step whose latest try still failed instead of keeping the retried step's error, whatever order events are read in. Its message was not kept, so the error carries the step only. Refs #19481
2e3db4c to
b2b4775
Compare
A failed Airflow task try read after a later try of the same task stored its error, so the run could blame a task its retry fixed and lose the error of the task that failed it. Refs #19481
Each cached pipeline holds its whole task list, since every write replaces it, so a cap on pipelines left memory unbounded for large pipelines. Weigh entries by task count (50,000 in all, about 1 KB each); a pipeline dropped from the cache is read again from the server, which holds every task written. Refs #19481
A step's task, its status lines and the run error's failedTask carried the full job name (nightly_retry.load) while the native Airflow connector names the same task by its task_id (load). Drop the "<pipeline job>." prefix in all three, and keep displayName equal to the name. A name without that prefix, such as a dbt model named after its table, is kept whole. Refs #19481
| still_failing = _first_step_still_failing(lines, other_than=update.job) | ||
| if still_failing is not None: | ||
| error = ExecutionError(failedTask=still_failing) | ||
| elif status != StatusType.Failed: | ||
| error = None |
There was a problem hiding this comment.
Could you check whether out-of-order events leave the error attached to a recovered task? Using retried_run_where_load_fails, replay [0, 1, 2, "dag_fails", 5, 6, 7, "load_fails"]. Here, flaky fails, the DAG failure arrives, flaky succeeds on retry, then load’s failure arrives. I get error.failedTask == "flaky" instead of "load", so the failed run points users to a recovered task.
Could we cover this order with a regression test?
A run's error now names the same step whichever order its events arrive in: - A step failure read after a later try made the blamed step good replaces the stale error (the order reported in review: flaky fails, the DAG run fails, flaky passes on retry, then load's failure arrives). - A task failure read after its DAG run's own failure names the task. - An Airflow task made good by a retry no longer stays blamed on a failed DAG run when no other task is failing. A Spark SQL job keeps the blame, since its failure failed the application. Also: - Find the pipeline that launched a run when its DAG id holds a dot, by matching the quoted FQN suffix instead of parsing every cached FQN. - Read a malformed jobType facet as no job type, so naming an event can no longer stop the whole ingestion and its Kafka offsets. - Cover a dbt run (jobType JOB) started by another job.
With several failing steps, the blamed step depended on the order events were read in: read as DAG run, B, A, the row blamed B although A failed first. Spark had the same problem with two failing SQL jobs. A step failure now takes the blame when the error is the run's own, names an Airflow task a later try made good, or names a step that first failed later. A step failed when its first failed try ended, so parallel tasks that fail in another order than they started are ranked correctly. Only an Airflow task is retried: a Spark SQL job named like a failed one is another job, so the failed one keeps the blame.
Spark sends COMPLETE after a SQL job's FAIL, and the line's end moved to the COMPLETE time when it was read last. The failure then looked later than it was, so another job's failure could take the blame depending on the reading order. A failed try now keeps the time it failed. Also covers a task failing while another is retried: the blame ends on the right task whether the retry passes or fails, and the failing task keeps its message when the retry passes.
… Skipped - A runId that carries no time (senders before OpenLineage 1.15) cannot join the run's steps to its row, so a Spark application whose step failed showed as Successful. Such runs now get no status and log one warning. - Producers send ABORT for a skipped or canceled dbt node, a killed dbt command and a canceled Flink job, so it maps to Skipped instead of Failed. - Fix the UI test comment on task line order and cover a latest try that is not the last line.
UI browser testsRan: all test files (no impact map from main yet) Result: ✅ 1072 passed · 154 skipped Changed code executed by these browser tests: 1 / 4 lines (25%)
|
Add the task-count-weighted cap of 50,000 tasks, its memory cost and its re-read behaviour to the pipelines-and-steps decision record, and correct the per-task size in the code comment (measured 1 to 2 KB).
Code Review ✅ Approved 🟡 Medium risk 7 closed / 7 findingsThe connector persists merged OpenLineage run outcomes and task attempts; UUIDv7-only keys could leave legacy runs without status. Records OpenLineage run outcomes and task attempts as one ✅ 7 closed✅ Quality: Run-status keying and merge rules are not in any decision record
✅ Bug: Same-named Spark SQL job success wipes the error of a run it failed
✅ Bug: Late retry read after DAG FAIL keeps the error of the task it made good
✅ Edge Case: Stale failed try read after its retry succeeded still becomes the error
✅ Edge Case: Blamed step depends on read order when two steps fail after the DAG FAIL
...and 2 more closed from earlier reviews VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Summary by Gitar
run_status.pymerging OpenLineage run events into onePipelineStatusrow per run, keyed by UUIDv7 runId time.yield_pipeline_statusrecords run status, task lines, and errors.Skippedstatus, and FAIL events map toFailed.getTaskExecStatusshows a retried task's status from its latest try.This will update automatically on new commits.


Confidence Score: 5/5
The PR appears safe to merge; the previous replay-order issue is fixed and no new actionable issues were found.Summary
Records OpenLineage run outcomes and task attempts in one
PipelineStatusrow per run.No new actionable issues were found. Checks were based on code inspection; tests were not run.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[OpenLineage event] --> B[Find pipeline and run] B --> C[Keep pipeline tasks and dates] C --> D[Find stored run row] D --> E[Merge run outcome and task attempt] E --> F[Write PipelineStatus] B --> G{FAIL or ABORT?} G -->|No| H[Write dataset and launch lineage] G -->|Yes| I[Skip lineage]Reviews (11) · Last reviewed commit: "fix(openlineage): keep a failed try's fa..." · Reviewed by Greptile