Pipelines: Metrics don't show with latest kfp version

Created on 12 Nov 2019  路  3Comments  路  Source: kubeflow/pipelines

What happened:
When I add a metric to a pipeline step, the metric does not get visualized in the UI.

What did you expect to happen:
I expect the metric to show in the UI.

What steps did you take:
[A clear and concise description of what the bug is.]
I deployed kubeflow v0.7.0 that comes with the kubeflow pipelines.
For on of my pipelines, I added a metric according to https://www.kubeflow.org/docs/pipelines/sdk/pipelines-metrics/ and subsequently ran the pipeline. The metric is not displayed on the the experiment page and also not on the detailed 'run output' page of the run.

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
If I change the KFP version to 0.1.26, I can see the metric showing up in the pipeline so it's probably something related to the KFP version to compile the pipeline.

aresddsl

Most helpful comment

You now need to explicitly define all outputs including the metrics one.
See https://github.com/kubeflow/pipelines/pull/2046/files#diff-a65b15d94e67f77a796e4940651e5c62R7

If you use func_to_container_op, do this:

def test() -> NamedTuple('MyDivmodOutput', [('mlpipeline_ui_metadata', 'UI_metadata'), ('mlpipeline_metrics', 'Metrics')]):
    ...
    return (json.dumps(metadata), json.dumps(metrics))

If you write component.yaml manually, see https://github.com/kubeflow/pipelines/pull/2046/files#diff-a65b15d94e67f77a796e4940651e5c62R7

if you're creating ContainerOp directly, then the best option is to switch to component.yaml authoring. But as a workaround you can add the metrics output to ContainerOp(..., file_outputs={}).

All 3 comments

You now need to explicitly define all outputs including the metrics one.
See https://github.com/kubeflow/pipelines/pull/2046/files#diff-a65b15d94e67f77a796e4940651e5c62R7

If you use func_to_container_op, do this:

def test() -> NamedTuple('MyDivmodOutput', [('mlpipeline_ui_metadata', 'UI_metadata'), ('mlpipeline_metrics', 'Metrics')]):
    ...
    return (json.dumps(metadata), json.dumps(metrics))

If you write component.yaml manually, see https://github.com/kubeflow/pipelines/pull/2046/files#diff-a65b15d94e67f77a796e4940651e5c62R7

if you're creating ContainerOp directly, then the best option is to switch to component.yaml authoring. But as a workaround you can add the metrics output to ContainerOp(..., file_outputs={}).

Alright thanks for the swift response and explanation.
Closing the issue.

@Ark-kun : I am adding this to clarify your answer above, because it took me a while to figure out what was going on.

To get metrics to show up in the UI when using ContainerOp, output _artifact_paths should contain the following items: ('mlpipeline-metrics', '/mlpipeline-metrics.json') and ('mlpipeline-ui-metadata', '/mlpipeline-ui-metadata.json')

Additionally, this has to be changed in the docstring for the constructor of ContainerOp as well here. I made PR #3444 to fix this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

goswamig picture goswamig  路  5Comments

IronPan picture IronPan  路  4Comments

discordianfish picture discordianfish  路  4Comments

zijianjoy picture zijianjoy  路  3Comments

radcheb picture radcheb  路  4Comments