Skip to content

Fixes #19481: Record OpenLineage pipeline run status and tasks - #37990

Merged
akashverma0786 merged 14 commits into
mainfrom
feat/19481-openlineage-pipeline-status
Nov 26, 2026
Merged

akashverma0786 merged 14 commits into
mainfrom
feat/19481-openlineage-pipeline-status

Conversation

@akashverma0786

@akashverma0786 akashverma0786 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Gitar

  • New pipeline run status:
    • Added run_status.py merging OpenLineage run events into one PipelineStatus row per run, keyed by UUIDv7 runId time.
    • Each retried try of a step gets its own task line, and yield_pipeline_status records run status, task lines, and errors.
    • ABORT events map to Skipped status, and FAIL events map to Failed.
  • Pipeline tasks and dates:
    • Pipelines now get a task per job, plus Airflow DAG start dates and task dates when Airflow reports them.
    • Known pipeline tasks and start dates are cached per ingestion so later writes do not drop them.
  • Event handling:
    • FAIL and ABORT events now reach the status stage and no longer produce lineage.
    • Runs launched by another job get a lineage edge from the launching pipeline.
  • Error reporting:
    • Pipeline creation and status failures now report the error message and stack trace.
  • Tasks view:
    • getTaskExecStatus shows a retried task's status from its latest try.
  • Tests:
    • Added Spark and Airflow event fixtures with unit tests for run status, pipeline tasks, and dates.

This will update automatically on new commits.

RetriggerView in GreptileConfidence 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 PipelineStatus row per run.

  • OpenLineage events build one run status row with a line for each step try.
  • Runs launched by another pipeline keep their own identity and link back to the launcher.
  • Pipeline task lists keep jobs and dates reported across events.
  • Failed and aborted jobs update run status without adding dataset lineage.

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]
Loading

Reviews (11) · Last reviewed commit: "fix(openlineage): keep a failed try's fa..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@akashverma0786 akashverma0786 added the safe to test Add this label to run secure Github workflows on PRs label Nov 17, 2026
@akashverma0786
akashverma0786 requested a review from a team as a code owner November 18, 2026 12:44
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
@akashverma0786
akashverma0786 force-pushed the feat/19481-openlineage-pipeline-status branch from 2e3db4c to b2b4775 Compare November 19, 2026 06:37
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
Comment on lines +320 to +324
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: 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%)

File Changed lines Executed %
src/utils/PipelineDetailsUtils.tsx 4 1 25%

@akashverma0786 akashverma0786 added the skip-pr-checks Bypass PR metadata validation check label Nov 25, 2026
akashverma0786 and others added 3 commits November 25, 2026 17:10
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).
@gitar-bot

gitar-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 7 closed / 7 findings

The 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 PipelineStatus row per run, with runs launched by another pipeline linked back to their launcher. Several blame and error-merge issues were resolved, including same-named Spark SQL job success wiping a run's error, stale or late failed tries overriding the good retry, and step blame depending on read order. The known-pipelines cache cap is now documented in docs/decisions/2026-11-18-openlineage-runs-are-their-own-pipelines-and-steps-join-their-parent.md. No open findings remain.

✅ 7 closed
✅ Quality: Run-status keying and merge rules are not in any decision record

📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:14-22 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:54-56 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:124-129 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:162-167 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:215-229 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/metadata.py:129-135 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/metadata.py:218 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/metadata.py:1106-1108
This PR adds a contract that other writers and later ingestions have to agree on. The OpenLineage status row for a run is keyed by the 48-bit millisecond prefix of its UUIDv7 runId. A run whose id is not UUIDv7 falls back to the eventTime of its own final event. Either way executionId is set to the runId, and that is what lets every ingestion find the same row (run_status.py:14-18, 124-129, 162-167). The PR also sets merge rules: the status never goes back down the order Pending → Successful → Failed; a FAIL or ABORT from a direct child job fails the parent run and opens its row; and FAIL/ABORT events now go through the pipeline and status stages but write no lineage (metadata.py:218, 1106-1108). The PR description is empty, and docs/decisions/ has no OpenLineage run-status record. The only OpenLineage record there covers Kafka dataset resolution. So these rules exist only in a module docstring. A record would state something like: "An OpenLineage pipeline run is recorded as one PipelineStatus whose timestamp is the UUIDv7 time of the root runId (or the end time of the run's own final event when the runId carries no time) and whose executionId is that runId; a run's status only advances Pending→Successful→Failed, a failure of a job whose parent is the pipeline run fails the run, and FAIL/ABORT events update status but never lineage."

✅ Bug: Same-named Spark SQL job success wipes the error of a run it failed

📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:285-295 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:307
The rule that drops the error assumes a later successful line with the same job name is a retry of the failed step. That holds for Airflow tasks. Spark is different: it names a SQL job <app>.<action>.<table>, so one application that runs the same write twice sends two steps with the same name and different runIds. If the first one fails, it sets fails_run, which pins the row at Failed and stores its error. When the second one completes, it matches error.failedTask == update.job with a Successful line, and the code sets error = None. The row ends up Failed with no error explaining why. The fix is to clear the error only while the run itself has not been failed by that step, for example by also requiring status != StatusType.Failed. Another option is to restrict the clearing to step types in _STEPS_THAT_LEAVE_THE_RUN_OUTCOME_TO_IT.

✅ Bug: Late retry read after DAG FAIL keeps the error of the task it made good

📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:293-301 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:313 📄 ingestion/tests/unit/topology/pipeline/test_openlineage_status.py:800-813
Take the sequence test_retry_read_after_the_dag_run_failed_leaves_the_run_its_error sets up. Event 2 (flaky try 1 FAIL) stores flaky's error. Next, load_fails arrives, but error or update.error (L313) keeps flaky's error and throws load's away. dag_fails then sets the run to Failed. When events 5 and 6 (flaky's successful try) are read later, the new status != StatusType.Failed guard stops the error from being cleared. The row ends up Failed with failedTask == "nightly_retry.flaky", which names the task the retry fixed instead of load, the task that actually failed the run. The ADR's guard test name forbids exactly this, and the new test passes only because it checks row.error is not None. Before this change the same reads left no error, so the change trades a missing error for a wrong one. Out-of-order reads are a case the ADR covers (test_tries_read_out_of_order_...). A fix would keep the error per line, or remember the first error of each step that is still failing, so clearing flaky's error can fall back to load's. Either way, the test should assert failedTask == "nightly_retry.load".

✅ Edge Case: Stale failed try read after its retry succeeded still becomes the error

📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:295-309 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:327 📄 ingestion/tests/unit/topology/pipeline/test_openlineage_status.py:654-659
When there is no stored error yet, merge_run_status sets the row's error to error or update.error (L327) without checking whether that step's latest try still fails. The re-blame check at L306 only runs when the incoming event is a successful try of the blamed step, so it cannot catch this case.

How it happens: an Airflow run whose flaky try 3 COMPLETE is read before try 1's FAIL, followed by load FAIL and the DAG FAIL. After try 3 is read, the row has no error. When try 1's FAIL arrives, its stale error is stored (TASK steps don't set fails_run). It stays there through load's failure. The final row then blames nightly_retry.flaky with its message, even though flaky succeeded on retry and load is the task that failed.

The ADR says the row's error is "the first failure that still stands", and that rows are stable "in whatever order" events are read. test_tries_read_out_of_order_each_find_their_own_line misses this because its DAG run ends Successful, which clears the error.

Fix: for steps that leave the outcome to the run (not update.fails_run), only use update.error if the latest try of update.job in lines is Failed. Add an out-of-order test where the DAG run ends in FAIL.

✅ Edge Case: Blamed step depends on read order when two steps fail after the DAG FAIL

📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:285-291 📄 ingestion/src/metadata/ingestion/source/pipeline/openlineage/run_status.py:342-345 📄 docs/decisions/2026-11-18-openlineage-run-status-is-one-row-per-run-keyed-by-its-runid-time.md:37-44
The updated ADR now says the row's error is "the first failure that still stands, whatever order its events are read in". _names_no_failing_step doesn't hold that when more than one task fails. Take tasks A and B that both fail, A first (parallel branches, or a downstream task with trigger_rule=all_done), followed by the DAG FAIL.

  • Read A, B, DAG: A's error is stored. When B arrives, the error names A, A's latest try failed, and update.leaves_outcome_to_run is True, so the function returns False. The row keeps A.
  • Read DAG, B, A: the DAG's own error has failedTask=None, so B replaces it (line 345). When A arrives, the error names B and B's latest try failed, so it returns False again. The row keeps B, the later failure.

So the same run gets a different failedTask depending on read order. The new test test_dag_run_failure_read_before_its_task_failure_still_names_the_task only covers a single failing task, so it misses this. Fix: when the blamed step is still failing, also let the incoming failure take its place if its try started earlier, using the same _try_time ordering _first_step_still_failing uses. Add a test with two failing tasks read as DAG, B, A.

...and 2 more closed from earlier reviews

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@akashverma0786
akashverma0786 enabled auto-merge (squash) November 26, 2026 10:08
@akashverma0786
akashverma0786 merged commit 345d26c into main Nov 26, 2026
48 checks passed
@akashverma0786
akashverma0786 deleted the feat/19481-openlineage-pipeline-status branch November 26, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants