Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Compiler - Validating Argo validator #3874

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions sdk/python/kfp/compiler/compiler.py
Expand Up @@ -998,6 +998,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 @@ -1010,3 +1026,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