Skip to content

Commit

Permalink
fix(sdk): added clearer error for case when user uses watch and argo …
Browse files Browse the repository at this point in the history
…isn't installed (#4511)
  • Loading branch information
izapolsk committed Sep 20, 2020
1 parent 0653e7c commit 37362a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sdk/python/kfp/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 37362a3

Please sign in to comment.