-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block users from importing argo workflows in pipeline import modal
- Loading branch information
Showing
28 changed files
with
914 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/argo-workflow-pipeline.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
annotations: | ||
pipelines.kubeflow.org/kfp_sdk_version: 1.8.22 | ||
pipelines.kubeflow.org/pipeline_compilation_time: '2023-09-26T08:36:45.160091' | ||
pipelines.kubeflow.org/pipeline_spec: '{"description": "A sample pipeline to generate | ||
Confusion Matrix for UI visualization.", "name": "confusion-matrix-pipeline"}' | ||
creationTimestamp: | ||
generateName: confusion-matrix-pipeline- | ||
labels: | ||
pipelines.kubeflow.org/kfp_sdk_version: 1.8.22 | ||
spec: | ||
arguments: {} | ||
entrypoint: confusion-matrix-pipeline | ||
serviceAccountName: pipeline-runner | ||
templates: | ||
- dag: | ||
tasks: | ||
- arguments: {} | ||
name: confusion-visualization | ||
template: confusion-visualization | ||
inputs: {} | ||
metadata: {} | ||
name: confusion-matrix-pipeline | ||
outputs: {} | ||
- container: | ||
args: | ||
- "--matrix-uri" | ||
- https://raw.githubusercontent.com/kubeflow/pipelines/master/samples/core/visualization/confusion_matrix.csv | ||
- "----output-paths" | ||
- "/tmp/outputs/mlpipeline_ui_metadata/data" | ||
command: | ||
- sh | ||
- "-ec" | ||
- | | ||
program_path=$(mktemp) | ||
printf "%s" "$0" > "$program_path" | ||
python3 -u "$program_path" "$@" | ||
- | | ||
def confusion_visualization(matrix_uri = 'https://raw.githubusercontent.com/kubeflow/pipelines/master/samples/core/visualization/confusion_matrix.csv'): | ||
"""Provide confusion matrix csv file to visualize as metrics.""" | ||
import json | ||
metadata = { | ||
'outputs' : [{ | ||
'type': 'confusion_matrix', | ||
'format': 'csv', | ||
'schema': [ | ||
{'name': 'target', 'type': 'CATEGORY'}, | ||
{'name': 'predicted', 'type': 'CATEGORY'}, | ||
{'name': 'count', 'type': 'NUMBER'}, | ||
], | ||
'source': matrix_uri, | ||
'labels': ['rose', 'lily', 'iris'], | ||
}] | ||
} | ||
from collections import namedtuple | ||
visualization_output = namedtuple('VisualizationOutput', [ | ||
'mlpipeline_ui_metadata']) | ||
return visualization_output(json.dumps(metadata)) | ||
import argparse | ||
_parser = argparse.ArgumentParser(prog='Confusion visualization', description='Provide confusion matrix csv file to visualize as metrics.') | ||
_parser.add_argument("--matrix-uri", dest="matrix_uri", type=str, required=False, default=argparse.SUPPRESS) | ||
_parser.add_argument("----output-paths", dest="_output_paths", type=str, nargs=1) | ||
_parsed_args = vars(_parser.parse_args()) | ||
_output_files = _parsed_args.pop("_output_paths", []) | ||
_outputs = confusion_visualization(**_parsed_args) | ||
_output_serializers = [ | ||
str, | ||
] | ||
import os | ||
for idx, output_file in enumerate(_output_files): | ||
try: | ||
os.makedirs(os.path.dirname(output_file)) | ||
except OSError: | ||
pass | ||
with open(output_file, 'w') as f: | ||
f.write(_output_serializers[idx](_outputs[idx])) | ||
image: python:3.7 | ||
name: '' | ||
resources: {} | ||
inputs: {} | ||
metadata: | ||
annotations: | ||
pipelines.kubeflow.org/arguments.parameters: '{"matrix_uri": "https://raw.githubusercontent.com/kubeflow/pipelines/master/samples/core/visualization/confusion_matrix.csv"}' | ||
pipelines.kubeflow.org/component_ref: "{}" | ||
pipelines.kubeflow.org/component_spec: '{"description": "Provide confusion | ||
matrix csv file to visualize as metrics.", "implementation": {"container": | ||
{"args": [{"if": {"cond": {"isPresent": "matrix_uri"}, "then": ["--matrix-uri", | ||
{"inputValue": "matrix_uri"}]}}, "----output-paths", {"outputPath": "mlpipeline_ui_metadata"}], | ||
"command": ["sh", "-ec", "program_path=$(mktemp)\nprintf \"%s\" \"$0\" > | ||
\"$program_path\"\npython3 -u \"$program_path\" \"$@\"\n", "def confusion_visualization(matrix_uri | ||
= ''https://raw.githubusercontent.com/kubeflow/pipelines/master/samples/core/visualization/confusion_matrix.csv''):\n \"\"\"Provide | ||
confusion matrix csv file to visualize as metrics.\"\"\"\n import json\n\n metadata | ||
= {\n ''outputs'' : [{\n ''type'': ''confusion_matrix'',\n ''format'': | ||
''csv'',\n ''schema'': [\n {''name'': ''target'', ''type'': | ||
''CATEGORY''},\n {''name'': ''predicted'', ''type'': ''CATEGORY''},\n {''name'': | ||
''count'', ''type'': ''NUMBER''},\n ],\n ''source'': matrix_uri,\n ''labels'': | ||
[''rose'', ''lily'', ''iris''],\n }]\n }\n\n from collections | ||
import namedtuple\n visualization_output = namedtuple(''VisualizationOutput'', | ||
[\n ''mlpipeline_ui_metadata''])\n return visualization_output(json.dumps(metadata))\n\nimport | ||
argparse\n_parser = argparse.ArgumentParser(prog=''Confusion visualization'', | ||
description=''Provide confusion matrix csv file to visualize as metrics.'')\n_parser.add_argument(\"--matrix-uri\", | ||
dest=\"matrix_uri\", type=str, required=False, default=argparse.SUPPRESS)\n_parser.add_argument(\"----output-paths\", | ||
dest=\"_output_paths\", type=str, nargs=1)\n_parsed_args = vars(_parser.parse_args())\n_output_files | ||
= _parsed_args.pop(\"_output_paths\", [])\n\n_outputs = confusion_visualization(**_parsed_args)\n\n_output_serializers | ||
= [\n str,\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n try:\n os.makedirs(os.path.dirname(output_file))\n except | ||
OSError:\n pass\n with open(output_file, ''w'') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"], | ||
"image": "python:3.7"}}, "inputs": [{"default": "https://raw.githubusercontent.com/kubeflow/pipelines/master/samples/core/visualization/confusion_matrix.csv", | ||
"name": "matrix_uri", "optional": true, "type": "String"}], "name": "Confusion | ||
visualization", "outputs": [{"name": "mlpipeline_ui_metadata", "type": "UI_metadata"}]}' | ||
labels: | ||
pipelines.kubeflow.org/enable_caching: 'true' | ||
pipelines.kubeflow.org/kfp_sdk_version: 1.8.22 | ||
pipelines.kubeflow.org/pipeline-sdk-type: kfp | ||
name: confusion-visualization | ||
outputs: | ||
artifacts: | ||
- name: mlpipeline-ui-metadata | ||
path: "/tmp/outputs/mlpipeline_ui_metadata/data" | ||
status: | ||
finishedAt: | ||
startedAt: |
Oops, something went wrong.