Skip to content

Conversation

@SoumyaRaikwar
Copy link

What this PR does

Implements SDK method to download component logs from pipeline runs, addressing the feature request in #12388.

Changes

  • get_logs(): Public method to retrieve logs by run ID and optional component name
  • _get_workflow_name_from_run(): Helper to extract Argo workflow names
  • _extract_component_name_from_pod(): Helper to parse component names from pod metadata
  • Comprehensive unit tests with mocking (no cluster required)

Features

Fetch single component logs (returns string)
Fetch all component logs (returns dict)
Multi-user namespace support
Graceful container fallback handling

Testing

  • 11 new test cases
  • Code formatted with YAPF
  • Follows existing test patterns

Fixes #12388

Implements kubeflow#12388 by adding SDK support for downloading logs from
pipeline run components.

Changes:
- Added get_logs() public method to Client class
- Added helper methods _get_workflow_name_from_run() and
  _extract_component_name_from_pod()
- Added comprehensive unit tests with mocking
- Leverages existing kubernetes dependency (v30.1.0)

Features:
- Fetch logs from specific component by name
- Fetch logs from all components in a run
- Support for multi-user namespace configurations
- Graceful fallback for different container configurations

Tests:
- 11 new test cases covering success and error scenarios
- All tests use mocking (no cluster required)
- Follows existing test patterns from client_test.py

Fixes kubeflow#12388

Signed-off-by: SoumyaRaikwar <[email protected]>
@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 @SoumyaRaikwar. 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.

@github-actions
Copy link

🚫 This command cannot be processed. Only organization members or owners can use the commands.

@SoumyaRaikwar
Copy link
Author

@VaniHaripriya , @mprahl and @DharmitD could you please review my pr .

@SoumyaRaikwar
Copy link
Author

@mprahl could you please review my pr


namespace = namespace or self.get_user_namespace()

run = self.get_run(run_id=run_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather this leverage the log artifacts automatically uploaded by the KFP launcher. This has the benefit of still working even if the pod gets deleted and it doesn't require the user to have access to the Kubernetes cluster itself.

Copy link
Author

Choose a reason for hiding this comment

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

done.

Changed implementation from Kubernetes pod querying to using KFP's
ReadArtifact API. This approach:
- Works even after pod deletion
- Doesn't require Kubernetes cluster access
- Leverages KFP's built-in artifact storage

Signed-off-by: SoumyaRaikwar <[email protected]>
@SoumyaRaikwar
Copy link
Author

@mprahl Updated to use artifact-based approach as suggested. Implementation now uses ReadArtifact API instead of direct Kubernetes pod querying. Works even after pod deletion and doesn't require cluster access. Ready for review.

@SoumyaRaikwar SoumyaRaikwar requested a review from mprahl November 5, 2025 21:52
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] Download component logs via SDK

2 participants