fix(sdk): handle Input[List[Dataset]] with dsl.Collected executor error. Fixes #12546#12547
fix(sdk): handle Input[List[Dataset]] with dsl.Collected executor error. Fixes #12546#12547wassimbensalem wants to merge 1 commit intokubeflow:masterfrom
Conversation
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 <bswassim@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/assign |
|
/ok-to-test |
Description
Fixes a bug where the executor crashes with
TypeError: list() takes no keyword argumentswhen components useInput[List[Dataset]](orInput[List[Artifact]]) withdsl.Collected.Root Cause
When the annotation is
Input[List[Dataset]], the executor was extractingList[Dataset]as the artifact class instead of the inner type (Dataset). It then tried to instantiate it withlist(**kwargs), which fails because Python'slist()constructor doesn't accept keyword arguments.Changes
Updated
assign_input_and_output_artifacts()inexecutor.py:Input[List[Dataset]]annotationsInputwrapper first, then checks if the result is a list and extracts its inner typeDataset) tomake_artifact()instead ofList[Dataset]Added safeguards in
create_artifact_instance()andmake_artifact():Listtype is passed as the artifact classAdded regression test:
test_list_of_datasets_input()inexecutor_test.pyverifies the fix works correctlyTesting
test_list_of_datasets_input()that verifiesInput[List[Dataset]]works correctlyRelated Issues
Fixes #12546