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

[UI] Supports storage: "inline" for all types of visualizations #3177

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

Bobgy
Copy link
Contributor

@Bobgy Bobgy commented Feb 27, 2020

/area frontend
/kind feature

Resolves #3133
Related to #3162

Metadata format is consistent with existing inline markdown:

metadata = {
        'outputs': [{
            'storage': 'inline',
            'source': '# Inline Markdown\n[A link](https://www.kubeflow.org/)',
            'type': 'markdown',
        }, {
            'storage': 'inline',
            'source': '<body>Hello, World!</body>',
            'type': 'web-app',
        }]
    }

Tried with the following pipeline.

import kfp
import kfp.components as comp

from typing import NamedTuple


#Define a Python function
def hello_world(name) -> NamedTuple('HelloWorldOutput', [(
        'echo', 'string'), ('mlpipeline_ui_metadata', 'UI_metadata')]):

    import json
    hello_world = """
    <html>
        <body>
            Hello_World
        </body>
    </html>
    """
    metadata = {
        'outputs': [{
            'storage': 'inline',
            'source': '# Inline Markdown\n[A link](https://www.kubeflow.org/)',
            'type': 'markdown',
        }, {
            'storage': 'inline',
            'source': hello_world,
            'type': 'web-app',
        }]
    }
    from collections import namedtuple
    output = namedtuple('HelloWorldOutput', ['echo', 'mlpipeline_ui_metadata'])
    return output(name + ': Hello, Wolrd!', json.dumps(metadata))


hello_world_op = comp.func_to_container_op(hello_world)

import kfp.dsl as dsl


@dsl.pipeline(
    name='Calculation pipeline',
    description='A toy pipeline that performs arithmetic calculations.')
def calc_pipeline(name='Placeholder'):
    #Passing pipeline parameter and a constant value as operation arguments
    add_task = hello_world_op(name)  #Returns a dsl.ContainerOp class instance.


#Specify pipeline argument values
arguments = {'name': 'Bob'}

#Submit a pipeline run
import kfp
client = kfp.Client(
    host='<FILL YOUR HOST HERE>')
client.list_pipelines()
result = client.create_run_from_pipeline_func(calc_pipeline,
                                              arguments=arguments)

print(result)

This change is Reviewable

@Bobgy
Copy link
Contributor Author

Bobgy commented Feb 27, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Bobgy

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rmgogogo
Copy link
Contributor

/lgtm

Awesome!!!

I didn't know we have so fancy feature.

@k8s-ci-robot k8s-ci-robot merged commit 852114e into kubeflow:master Feb 27, 2020
@Bobgy Bobgy deleted the fe_support_inline_html branch February 27, 2020 03:39
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
…flow#3177)

* [UI] Supports inline html visualization

* [UI] Support storage: "inline" for all types of visualization
magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this pull request Oct 22, 2023
…kubeflow#3177)

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
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.

Support inline sources in all visualizations
3 participants