-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(sdk): support input list of artifacts in Custom Container Components [lists of artifacts support pt. 4] #8484
feat(sdk): support input list of artifacts in Custom Container Components [lists of artifacts support pt. 4] #8484
Conversation
Skipping CI for Draft Pull Request. |
0b6729e
to
67592a9
Compare
/test all |
67592a9
to
7dc2f55
Compare
@@ -467,6 +467,37 @@ def create_component_from_func( | |||
component_spec=component_spec, python_func=func) | |||
|
|||
|
|||
def make_input_for_parameterized_container_component_function( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extracts existing code into a function and adds handling for new placeholders into the function
/unhold |
/hold until BE supports these placeholders |
7c3e44a
to
0d5533b
Compare
/unhold |
@dsl.container_component | ||
def comp_with_artifact_list(input_list: Input[List[Artifact]]): | ||
return dsl.ContainerSpec( | ||
image='alpine', command=[input_list], args=[input_list]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have an example that's executable to show case how the container can consume the list of artifacts, like printing out the artifact names, etc. Without that, the input is an opaque block and it's unclear to users how to actually use list of artifacts in container component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. For this PR, I've opted to remove read/write tests altogether since lists of artifacts are unusable until ParallelFor fan-in is implemented.
I will add real-world test cases in alongside ParallelFor fan-in (#8808).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
comp-comp-with-artifact-list: | ||
executorLabel: exec-comp-with-artifact-list | ||
inputDefinitions: | ||
artifacts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expect to see is_artifact_list
in the YAML?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, updated.
def __getattribute__(self, name: str) -> Any: | ||
if name in {'name', 'uri', 'metadata', 'path'}: | ||
raise AttributeError( | ||
f'Cannot access an attribute on a list of artifacts in a Custom Container Component. Found refence to attribute {name!r} on {self.input_name!r}. Please pass the whole list of artifacts only.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: refence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Updated.
0d5533b
to
6a109dc
Compare
@connor-mccarthy: The following test failed, say
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. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description of your changes:
Supports using lists of artifacts in Custom Container Components by enabling writing of placeholders of the form
"{{$.inputs.artifacts['input_name']}}"
via the following syntax:Also, write the
isArtifactList
field all components types.Creating output lists of artifacts is not yet supported, but will be supported by #8808. This change will also include type checking logic.
Checklist:
pull request title convention used in this repository.