Skip to content

Commit

Permalink
SDK - Compiler - Validating Argo validator (#3874)
Browse files Browse the repository at this point in the history
* SDK - Compiler - Validating Argo validator

* Added warning if argo is available, but not working
  • Loading branch information
Ark-kun authored Jul 11, 2020
1 parent 70ac32c commit bbc9ff5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sdk/python/kfp/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,22 @@ def _validate_workflow(workflow: dict):
Please create a new issue at https://github.com/kubeflow/pipelines/issues attaching the pipeline code and the pipeline package.'''
)

# Running Argo lint if available
import shutil
import subprocess
argo_path = shutil.which('argo')
if argo_path:
has_working_argo_lint = False
try:
has_working_argo_lint = _run_argo_lint('')
except:
warnings.warn("Cannot validate the compiled workflow. Found the argo program in PATH, but it's not usable. argo v2.4.3 should work.")

if has_working_argo_lint:
_run_argo_lint(yaml_text)


def _run_argo_lint(yaml_text: str):
# Running Argo lint if available
import shutil
import subprocess
Expand All @@ -998,3 +1014,5 @@ def _validate_workflow(workflow: dict):
Please create a new issue at https://github.com/kubeflow/pipelines/issues attaching the pipeline code and the pipeline package.
Error: {}'''.format(result.stderr.decode('utf-8'))
)
return True
return False

0 comments on commit bbc9ff5

Please sign in to comment.