Repository: kubeflow/pipelines

Issue:
[feature] kfp CLI support 'kfp run get <run_id>' in detailed information
### Feature Area

/area sdk

### What feature would you like to see?
Currently, `kfp run get <run_id>` only shows ["run id", "name", "status", "created at"].
However, user could want to see other information of the run.

### What is the use case or pain point?
For my case, I want to fetch my **run's output metrics** with kfp CLI


### Is there a workaround currently?

Since `kfp.Client()` already have `get_run()` method in sdk, which have all information including metrics of run,
I think the UX is only what matters: Which information would be useful or useless, and how user could select them.

For example, I guess `pipeline_Spec.workflow_manifest` could always be omitted, since nobody wants such information.

Therefore, I think with `click.option('--detail')` in get() method in `pipelines/sdk/python/kfp/cli/run.py` shows all information except `pipeline_Spec.workflow_manifest` in json format would be fine.

However, if there is other suggestions, please let me know.
Also, If you guys are ok, I'd like to took this issue and implement this feature.

---

<!-- Don't delete message below to encourage users to support your feature request! -->
Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.



Discussion:
This feature makes sense, welcome contribution!
/assign @anencore94 

Resolving patch:
diff --git a/sdk/python/kfp/cli/run.py b/sdk/python/kfp/cli/run.py
--- a/sdk/python/kfp/cli/run.py
+++ b/sdk/python/kfp/cli/run.py
@@ -11,15 +11,15 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
-
 import sys
 import subprocess
 import time
 import json
 import click
 import shutil
+import datetime
 
+import kfp
 from kfp.cli.output import print_output, OutputFormat
 
 
@@ -91,18 +91,31 @@ def submit(ctx, experiment_name, run_name, package_file, pipeline_id, pipeline_n
 @run.command()
 @click.option('-w', '--watch', is_flag=True, default=False,
               help='Watch the run status until it finishes.')
+@click.option('-d', '--detail', is_flag=True, default=False,
+              help='Get detailed information of the run in json format.')
 @click.argument('run-id')
 @click.pass_context
-def get(ctx, watch, run_id):
+def get(ctx, watch, detail, run_id):
     """display the details of a KFP run"""
     client = ctx.obj['client']
     namespace = ctx.obj['namespace']
     output_format = ctx.obj['output']
-    _display_run(client, namespace, run_id, watch, output_format)
+
+    _display_run(client, namespace, run_id, watch, output_format, detail)
 
 
-def _display_run(client, namespace, run_id, watch, output_format):
+def _display_run(client, namespace, run_id, watch, output_format, detail=False):
     run = client.get_run(run_id).run
+
+    if detail:
+        data = {
+            key: value.isoformat() if isinstance(value, datetime.datetime) else value
+            for key, value in run.to_dict().items()
+            if key not in ['pipeline_spec']  # useless but too much detailed field
+        }
+        click.echo(data)
+        return
+
     _print_runs([run], output_format)
     if not watch:
         return


Test patch: