Skip to content

Sync RuntimeTaskInstanceProtocol with RuntimeTaskInstance#67216

Merged
kaxil merged 1 commit into
apache:mainfrom
astronomer:sync-runtime-ti-protocol
May 20, 2026
Merged

Sync RuntimeTaskInstanceProtocol with RuntimeTaskInstance#67216
kaxil merged 1 commit into
apache:mainfrom
astronomer:sync-runtime-ti-protocol

Conversation

@kaxil
Copy link
Copy Markdown
Member

@kaxil kaxil commented May 19, 2026

RuntimeTaskInstanceProtocol (task-sdk/src/airflow/sdk/types.py) had drifted from RuntimeTaskInstance (task-sdk/src/airflow/sdk/execution_time/task_runner.py). This PR realigns the public protocol with what the runtime implementation actually exposes.

What changed

  • Fix get_first_reschedule_date signature. The protocol declared (self, first_try_number) but both the implementation and the only caller (sdk/bases/sensor.py:188) take a Context. Anyone type-checking against the protocol would have been told the wrong shape.
  • Broaden xcom_pull.task_ids to str | Iterable[str] | None to match the implementation (was str | list[str] | None).
  • Add missing public surface present on RuntimeTaskInstance but absent from the protocol:
    • log_url and mark_success_url properties (referenced externally, e.g. openlineage via getattr(ti, "log_url", None)).
    • render_templates(context, jinja_env) method.
    • is_mapped and rendered_map_index fields.

Align the public protocol with what the runtime implementation actually
exposes:

- Fix get_first_reschedule_date signature -- protocol declared
  (first_try_number) but the impl and the only caller
  (sdk/bases/sensor.py) take a Context.
- Broaden xcom_pull task_ids to str | Iterable[str] | None to match impl.
- Add public surface that was on RuntimeTaskInstance but missing from the
  protocol: log_url, mark_success_url, render_templates, plus is_mapped
  and rendered_map_index fields.
@amoghrajesh
Copy link
Copy Markdown
Contributor

We should try and come up with a prek hook for this imo. Fine for now.

@amoghrajesh
Copy link
Copy Markdown
Contributor

Trying to auto fix this for future cases: #67223

@kaxil kaxil merged commit 5aeb726 into apache:main May 20, 2026
113 checks passed
@kaxil kaxil deleted the sync-runtime-ti-protocol branch May 20, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants