Skip to content
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

display call for loaded component should show better view of component info #947

Closed
hongye-sun opened this issue Mar 8, 2019 · 10 comments
Closed
Assignees
Labels
area/sdk/components kind/feature lifecycle/stale The issue / pull request is stale, any activities remove this label. priority/p2

Comments

@hongye-sun
Copy link
Contributor

This is a use case in notebook, when user use ipython display API to display a loaded component. Currently, it only displays a normal python function signature. It's better to show more metadata including:
name, description, type information.

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

I'm thinking of this. I'm not sure IPython would allow showing more information for a function object. It should be showing the component.yaml source (and it sometimes does that), but that's flaky.

I was thinking about returning a callable ComponentSpec object instead of a function. But I'm afraid it would be confusing to people (they might not know that it's callable). I'd still like to try and do that.
What do you think?

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

It's better to show more metadata including: name, description, type information.

It has always shown this information. Can you show a screenshot where it does not?

@hongye-sun
Copy link
Contributor Author

Here is the sample output:

<function dataproc_submit_pig_job(project_id, region, cluster_name, queries='', query_file_uri='', script_variables='', pig_job='', job='', wait_interval='30')>

It doesn't show component description, parameter description, parameter type, output information.

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

Try this in Jupyter:

my_component = kfp.components.load_component_from_text(
'''
name: My component
description: This component does whatever I want
inputs:
- name: param1
  type: My custom type
implementation:
  container:
    image: docker/whalesay:latest
'''
)

then type my_component( and press Shift+Tab or just execute my_component?? or help(my_component). You'll get:

Signature: my_component(param1:'My custom type')
Docstring: This component does whatever I want
Source:  

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

What does dataproc_submit_pig_job?? show?

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

It doesn't show component ... parameter type

Well, that component does not specify types: https://github.com/kubeflow/pipelines/blob/master/components/gcp/dataproc/submit_pig_job/component.yaml

@hongye-sun
Copy link
Contributor Author

It shows component description in the doc string. Maybe we should also include inputs and outputs description in the docstring.

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 15, 2019

It doesn't show component description

Component description is used to for the docstring. But function's __str__ does not show the docstring. You need to invoke help(fun) or fun? or fun( + Shift+Tab.

Docstrings are not shown that way

parameter description, output information.

Yes, it might be a good idea to include those in the docstring.

@stale
Copy link

stale bot commented Jun 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale The issue / pull request is stale, any activities remove this label. label Jun 26, 2020
@stale
Copy link

stale bot commented Jul 3, 2020

This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.

@stale stale bot closed this as completed Jul 3, 2020
Linchin pushed a commit to Linchin/pipelines that referenced this issue Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdk/components kind/feature lifecycle/stale The issue / pull request is stale, any activities remove this label. priority/p2
Projects
None yet
Development

No branches or pull requests

3 participants