From 37362a344102509294e6257ad7af6246d18e171e Mon Sep 17 00:00:00 2001 From: Eugene Zapolsky Date: Sun, 20 Sep 2020 14:12:29 +0300 Subject: [PATCH] fix(sdk): added clearer error for case when user uses watch and argo isn't installed (#4511) --- sdk/python/kfp/cli/run.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/python/kfp/cli/run.py b/sdk/python/kfp/cli/run.py index 30d147e07c9..1f10d745445 100644 --- a/sdk/python/kfp/cli/run.py +++ b/sdk/python/kfp/cli/run.py @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .._client import Client + import sys import subprocess -import pprint import time import json import click +import shutil from tabulate import tabulate @@ -81,6 +81,13 @@ def _display_run(client, namespace, run_id, watch): _print_runs([run]) if not watch: return + argo_path = shutil.which('argo') + if not argo_path: + raise RuntimeError("argo isn't found in $PATH. It's necessary for watch. " + "Please make sure it's installed and available. " + "Installation instructions be found here - " + "https://github.com/argoproj/argo/releases") + argo_workflow_name = None while True: time.sleep(1) @@ -95,7 +102,7 @@ def _display_run(client, namespace, run_id, watch): print('Run is finished with status {}.'.format(run_detail.run.status)) return if argo_workflow_name: - subprocess.run(['argo', 'watch', argo_workflow_name, '-n', namespace]) + subprocess.run([argo_path, 'watch', argo_workflow_name, '-n', namespace]) _print_runs([run]) def _print_runs(runs):