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

Make expand() error vague so it's not misleading #24018

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/models/mappedoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _expand(self, **mapped_kwargs: "Mappable") -> "MappedOperator":
from airflow.operators.empty import EmptyOperator

validate_mapping_kwargs(self.operator_class, "expand", mapped_kwargs)
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="mapping already partial")
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="unmappable or already specified")
ephraimbuddy marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="unmappable or already specified")
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="unmappable or already specified (see https://airflow.apache.org/docs/apache-airflow/stable/concepts/dynamic-task-mapping.html#mapping-with-non-taskflow-operators )")

Don't we want to direct the user to the exact place in the docs where more context and details is explained? I think that would be an empathetic bahaviour towards the users who see it for the very first time.

Copy link
Member

Choose a reason for hiding this comment

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

We can even create a short link for it:

Suggested change
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="unmappable or already specified")
prevent_duplicates(self.kwargs, mapped_kwargs, fail_reason="unmappable or already specified (see https://s.apache.org/airflow-unmappable) ")

Copy link
Member Author

Choose a reason for hiding this comment

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

Personally I don’t like putting documentation links in the error message. We could make this more prominent in the documentation page though, perhaps adding a section with the error message in the title.

ensure_xcomarg_return_value(mapped_kwargs)

partial_kwargs = self.kwargs.copy()
Expand Down