Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash if operator_extra_links is a property #25332

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion airflow/models/mappedoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,22 @@ def _expand(self, expand_input: ExpandInput, *, strict: bool) -> "MappedOperator
start_date = partial_kwargs.pop("start_date")
end_date = partial_kwargs.pop("end_date")

# Some operators implement extra links as a run-time property (instead
# of a class-level attribute) that is only resolvable against a concrete
# task object. There's no way to resolve them here, just leave it empty.
if isinstance(self.operator_class.operator_extra_links, collections.abc.Collection):
operator_extra_links = self.operator_class.operator_extra_links
else:
operator_extra_links = ()

op = MappedOperator(
operator_class=self.operator_class,
expand_input=expand_input,
partial_kwargs=partial_kwargs,
task_id=task_id,
params=params,
deps=MappedOperator.deps_for(self.operator_class),
operator_extra_links=self.operator_class.operator_extra_links,
operator_extra_links=operator_extra_links,
template_ext=self.operator_class.template_ext,
template_fields=self.operator_class.template_fields,
template_fields_renderers=self.operator_class.template_fields_renderers,
Expand Down