-
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): add load_component_from_* #6822
Conversation
"""Loads component from file. | ||
|
||
Args: | ||
file_path: A string containing path to the file. The file could be YAML file or a zip file with a 'component.yaml' file inside. |
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.
The file could be YAML file or a zip file with a 'component.yaml' file inside.
Sorry, I may have mislead you. I think we should add the zip support so it's fully backward compatible.
(Earlier I was talking about v1 compiler can produce zip files, because KFP UI support uploading zip, and we don't need to do it for v2)
pipelines/sdk/python/kfp/compiler/compiler.py
Lines 1130 to 1145 in 40d8242
def compile(self, | |
pipeline_func, | |
package_path, | |
type_check: bool = True, | |
pipeline_conf: Optional[dsl.PipelineConf] = None): | |
"""Compile the given pipeline function into workflow yaml. | |
Args: | |
pipeline_func: Pipeline functions with @dsl.pipeline decorator. | |
package_path: The output workflow tar.gz file path. for example, | |
"~/a.tar.gz" | |
type_check: Whether to enable the type check or not, default: True. | |
pipeline_conf: PipelineConf instance. Can specify op transforms, image | |
pull secrets and other pipeline-level configuration options. Overrides | |
any configuration that may be set by the pipeline. | |
""" |
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.
Synced offline, will add this feature if requested.
with open(file_path, 'rb') as component_stream: | ||
return load_component_from_text(component_stream) | ||
|
||
def load_component_from_url(url: str, auth=None) -> base_component.BaseComponent: |
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.
nit: Add docstring for public method, also type annotate auth
(do we expect a string or what? I was not familiar with this usage).
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.
Added doc strings. auth
should be Any type here, depending on the URL request.
- {outputPath: output1} | ||
""") | ||
|
||
class YamlComponentTest(parameterized.TestCase): |
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.
nit: seems like you are not using parameterized, so maybe change this to unittest?
def test_load_component_from_text(self): | ||
component = yaml_component.load_component_from_text(SAMPLE_YAML) | ||
self.assertEqual(component.component_spec.name, 'component_1') | ||
self.assertEqual(component._component_inputs, {'input1'}) |
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.
nit: maybe check outputs and container as well?
/test kubeflow-pipelines-samples-v2 |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: 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 |
* feat(sdk): add load_component_from_* * address comments' : * update release notes
No description provided.