Skip to content

Commit c938247

Browse files
Ark-kunk8s-ci-robot
authored andcommitted
Fixed Kubeflow sample test (#1096)
* Fixed Kubeflow sample test * Fixed the artifact-finding logic in `get_artifact_in_minio`. It was just taking the first artifact before. Now it properly searches the artifact by name.
1 parent b36c7bc commit c938247

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

test/sample-test/run_kubeflow_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def main():
108108
# target, predicted, count
109109
cm_tar_path = './confusion_matrix.tar.gz'
110110
cm_filename = 'mlpipeline-ui-metadata.json'
111-
utils.get_artifact_in_minio(workflow_json, 'confusionmatrix', cm_tar_path)
111+
utils.get_artifact_in_minio(workflow_json, 'confusion-matrix', cm_tar_path)
112112
tar_handler = tarfile.open(cm_tar_path)
113113
tar_handler.extractall()
114114

test/sample-test/utils.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
# Parse the workflow json to obtain the artifacts for a particular step.
2020
# Note: the step_name could be the key words.
21-
def get_artifact_in_minio(workflow_json, step_name, output_path):
21+
def get_artifact_in_minio(workflow_json, step_name, output_path, artifact_name='mlpipeline-ui-metadata'):
2222
s3_data = {}
2323
minio_access_key = 'minio'
2424
minio_secret_key = 'minio123'
2525
try:
26-
for key in workflow_json['status']['nodes'].keys():
27-
if step_name in workflow_json['status']['nodes'][key]['name']:
28-
s3_data = workflow_json['status']['nodes'][key]['outputs']['artifacts'][0]['s3']
26+
for node in workflow_json['status']['nodes'].values():
27+
if step_name in node['name']:
28+
for artifact in node['outputs']['artifacts']:
29+
if artifact['name'] == artifact_name:
30+
s3_data = artifact['s3']
2931
minio_client = Minio(s3_data['endpoint'], access_key=minio_access_key, secret_key=minio_secret_key, secure=False)
3032
data = minio_client.get_object(s3_data['bucket'], s3_data['key'])
3133
with open(output_path, 'wb') as file:

0 commit comments

Comments
 (0)