Skip to content

Conversation

@wassimbensalem
Copy link

Description

Fixes a bug where the executor crashes with TypeError: list() takes no keyword arguments when components use Input[List[Dataset]] (or Input[List[Artifact]]) with dsl.Collected.

Root Cause

When the annotation is Input[List[Dataset]], the executor was extracting List[Dataset] as the artifact class instead of the inner type (Dataset). It then tried to instantiate it with list(**kwargs), which fails because Python's list() constructor doesn't accept keyword arguments.

Changes

  1. Updated assign_input_and_output_artifacts() in executor.py:

    • Properly extracts the inner artifact type from Input[List[Dataset]] annotations
    • Strips the Input wrapper first, then checks if the result is a list and extracts its inner type
    • Passes the correct inner type (Dataset) to make_artifact() instead of List[Dataset]
  2. Added safeguards in create_artifact_instance() and make_artifact():

    • Detects if a List type is passed as the artifact class
    • Extracts the inner type before attempting instantiation
    • Prevents similar crashes in edge cases
  3. Added regression test:

    • test_list_of_datasets_input() in executor_test.py verifies the fix works correctly

Testing

  • Added unit test test_list_of_datasets_input() that verifies Input[List[Dataset]] works correctly
  • Verified fix locally using the installed SDK
  • All existing tests continue to pass (backward compatible)

Related Issues

Fixes #12546

When using Input[List[Dataset]] with dsl.Collected, the executor was failing with 'TypeError: list() takes no keyword arguments'.
This was because the executor was incorrectly trying to instantiate the List type itself instead of the inner artifact type (Dataset).

Changes:
- Updated assign_input_and_output_artifacts in executor.py to correctly extract the inner artifact type (e.g., Dataset) from Input[List[Dataset]] annotations.
- Added safeguards in create_artifact_instance and make_artifact to handle cases where a List type is passed as the artifact class, preventing crashes.
- Added a regression test test_list_of_datasets_input in executor_test.py to verify the fix and ensure backward compatibility.

Fixes kubeflow#12546

Signed-off-by: wassimbensalem <[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 @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.

@wassimbensalem
Copy link
Author

/assign

@zazulam
Copy link
Contributor

zazulam commented Dec 11, 2025

/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.

[sdk] Executor crashes with TypeError when using Input[List[Dataset]] with dsl.Collected

2 participants