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

Support rendering build operator task-id with non-ASCII characters #1415

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Changes from 2 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
10 changes: 7 additions & 3 deletions cosmos/airflow/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,22 @@ def _get_task_id_and_args(
use_task_group: bool,
normalize_task_id: Callable[..., Any] | None,
resource_suffix: str,
include_resource_type: bool = False,
) -> tuple[str, dict[str, Any]]:
"""
Generate task ID and update args with display name if needed.
"""
args_update = args
task_display_name = f"{node.name}_{resource_suffix}"
if include_resource_type:
task_display_name = f"{node.name}_{node.resource_type.value}_{resource_suffix}"
if use_task_group:
task_id = resource_suffix
elif normalize_task_id:
task_id = normalize_task_id(node)
args_update["task_display_name"] = f"{node.name}_{resource_suffix}"
args_update["task_display_name"] = task_display_name
else:
task_id = f"{node.name}_{resource_suffix}"
task_id = task_display_name
return task_id, args_update


Expand Down Expand Up @@ -214,7 +218,7 @@ def create_task_metadata(
}

if test_behavior == TestBehavior.BUILD and node.resource_type in SUPPORTED_BUILD_RESOURCES:
task_id = f"{node.name}_{node.resource_type.value}_build"
task_id, args = _get_task_id_and_args(node, args, use_task_group, normalize_task_id, "build", True)
tatiana marked this conversation as resolved.
Show resolved Hide resolved
elif node.resource_type == DbtResourceType.MODEL:
task_id, args = _get_task_id_and_args(node, args, use_task_group, normalize_task_id, "run")
elif node.resource_type == DbtResourceType.SOURCE:
Expand Down
Loading