Skip to content

Conversation

@wassimbensalem
Copy link

Summary

Enables set_display_name() to affect Kubernetes pod names for container tasks, improving cluster-side debugging and resource monitoring.

Benefits

  • Easier debugging: Pod names match display names, simplifying task identification in kubectl, logs, and monitoring tools
  • Resource monitoring: In ParallelFor loops, each iteration's pod has a clear name, enabling per-component resource usage tracking
  • Better observability: Metrics and logs can be easily correlated with pipeline tasks

Changes

  • pipeline_task.py: Enhanced set_display_name() to handle LoopArgumentVariable objects from ParallelFor loops
  • pipeline_spec_builder.py:
    • Use sanitized display_name as DAG task key for container tasks
    • Fix producer task references in groups (ParallelFor, Condition, ExitHandler) to use correct DAG keys
    • Ensure uniqueness and enforce Kubernetes naming constraints

Features

  • Display names are sanitized and used for pod names
  • Supports loop variables: task.set_display_name(f"task-{loop_var.field}")
  • Handles duplicate names with automatic suffix
  • Truncates to fit Kubernetes 63-char limit
  • Fully backward compatible

Fixes

  • Resolves "unknown producer task" error when using display_name in groups

Testing

  • Added unit tests for display_name functionality
  • Tested with ParallelFor loops
  • Verified backward compatibility

Related

Closes #12434

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign connor-mccarthy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link

Hi @wassimbensalem. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Enables set_display_name() to affect Kubernetes pod names for container
tasks, improving cluster-side debugging and resource monitoring.

Benefits:
- Easier debugging: Pod names match display names, simplifying task
  identification in kubectl, logs, and monitoring tools
- Resource monitoring: In ParallelFor loops, each iteration's pod has a
  clear name, enabling per-component resource usage tracking
- Better observability: Metrics and logs can be easily correlated with
  pipeline tasks

Changes:
- pipeline_task.py: Enhanced set_display_name() to handle
  LoopArgumentVariable objects from ParallelFor loops
- pipeline_spec_builder.py:
  - Use sanitized display_name as DAG task key for container tasks
  - Fix producer task references in groups (ParallelFor, Condition,
    ExitHandler) to use correct DAG keys
  - Ensure uniqueness and enforce Kubernetes naming constraints

Features:
- Display names are sanitized and used for pod names
- Supports loop variables: task.set_display_name(f"task-{loop_var.field}")
- Handles duplicate names with automatic suffix
- Truncates to fit Kubernetes 63-char limit
- Fully backward compatible

Fixes:
- Resolves "unknown producer task" error when using display_name in groups

Testing:
- Added unit tests for display_name functionality
- Tested with ParallelFor loops
- Verified backward compatibility

Related to: kubeflow#12434

Signed-off-by: wassimbensalem <[email protected]>
@droctothorpe droctothorpe force-pushed the feat/display-name-for-pod-names-12434 branch from 9cf53c2 to 4c11aee Compare November 16, 2025 14:50
@droctothorpe
Copy link
Collaborator

/ok-to-test

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.

[feature] Support display_name for Kubernetes Pod Names

2 participants