Skip to content

Commit 669fcf1

Browse files
committed
tests written for injecting evaluation files
1 parent 6ff84c4 commit 669fcf1

22 files changed

+515
-68
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ max-line-length = 79
107107
max-complexity = 18
108108
per-file-ignores =
109109
src/exec_file.py:F821
110-
tests/sample_exec_file.py:F821
110+
tests/sample_*.py:F821
111111
# Specify the list of error codes you wish Flake8 to report.
112112
select = B,C,E,F,W,T4,B9
113113

.parameters/schemas/package_result.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ tested_platforms:
2929
type: list_strings
3030
required: True
3131

32+
package_size:
33+
type: int
34+
required: True
35+
3236
model_source:
3337
# model_source: (Optional) - (Required if servable is true)
3438
type: nested

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pylint = "*"
99
black = "*"
1010
ipython = "*"
1111
flake8 = "*"
12+
rope = "*"
1213

1314
[packages]
1415
pyyaml = "*"

Pipfile.lock

Lines changed: 31 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
schema_version: 9999.0.1
2+
schema_type: data_process_run
3+
base_image: ubuntu1804
4+
machine_type: NDv2
5+
nodes: 5
6+
cpu_per_node: 8
7+
ram_per_node: 16Gi
8+
gpu_required: True
9+
output_root_path: 'https://contoso.s3.us-west-2.amazonaws.com/ml/processed_data'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
schema_version: 9999.0.1
2+
schema_type: data_source
3+
run_id: 6a9a5931-1c1d-47cc-aaf3-ad8b03f70575
4+
step_id: 433b4d99-042d-47c5-8c2f-6a4f5094510e
5+
run_date: 1970-01-08 00:00:00.00000
6+
source_id: 894b0239-e616-43fa-914b-de55894ad67d
7+
source_uri: 'https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/'

tests/.parameters/workflow.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
schema_type: workflow
2+
schema_version: 9999.0.1
3+
steps:
4+
process_data:
5+
input:
6+
schema_type: data_source
7+
schema_version: 9999.0.1
8+
execution:
9+
schema_type: data_process_run
10+
schema_version: 9999.0.1
11+
output:
12+
schema_type: data_result
13+
schema_version: 9999.0.1
14+
next: train
15+
train:
16+
previous: process_data
17+
input:
18+
schema_type: data_result
19+
schema_version: 9999.0.1
20+
execution:
21+
schema_type: training_run
22+
schema_version: 9999.0.1
23+
output:
24+
schema_type: training_result
25+
schema_version: 9999.0.1
26+
next: package
27+
package:
28+
previous: train
29+
input:
30+
schema_type: training_result
31+
schema_version: 9999.0.1
32+
execution:
33+
schema_type: package_run
34+
schema_version: 9999.0.1
35+
output:
36+
schema_type: package_result
37+
schema_version: 9999.0.1

tests/bad_schemas/bad_base/data_result.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mlspec_base_type:
44

55
mlspec_schema_version:
66
# Identifies the version of this schema
7-
meta: 999.0.1
7+
meta: 9999.0.1
88

99
mlspec_schema_type:
1010
# Identifies the type of this schema

tests/sample_package_execution.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from mlspeclib import MLSchema, MLObject
2+
from random import randint, random, randrange
3+
from pathlib import Path
4+
import uuid
5+
6+
results_ml_object.set_type(
7+
schema_type=result_ml_object_schema_type, schema_version=result_ml_object_schema_version,
8+
)
9+
10+
# Mocked up results
11+
return_dict = YAML.safe_load(
12+
"""
13+
servable: True
14+
package_size: 1029310298
15+
tested_platforms: ['kubeflow', 'azureml', 'sagemaker']
16+
model_source:
17+
servable_model:
18+
data_store: 's3'
19+
bucket: 'nlp-bucket'
20+
path: 'a231653454ca8e07f42adc7941aeec6b'
21+
serving_container_image:
22+
container_image_url: 'https://hub.docker.com/repository/docker/contoso/nlp-base-images'
23+
"""
24+
)
25+
26+
results_ml_object.servable = return_dict["servable"]
27+
results_ml_object.tested_platforms = return_dict["tested_platforms"]
28+
results_ml_object.package_size = return_dict["package_size"]
29+
results_ml_object.model_source.servable_model.data_store = return_dict["model_source"][
30+
"servable_model"
31+
]["data_store"]
32+
results_ml_object.model_source.servable_model.bucket = return_dict["model_source"][
33+
"servable_model"
34+
]["bucket"]
35+
results_ml_object.model_source.servable_model.path = return_dict["model_source"][
36+
"servable_model"
37+
]["path"]
38+
results_ml_object.serving_container_image.container_image_url = return_dict[
39+
"serving_container_image"
40+
]["container_image_url"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from mlspeclib import MLSchema, MLObject
2+
from random import randint, random
3+
from pathlib import Path
4+
5+
results_ml_object.set_type(
6+
schema_type=result_ml_object_schema_type, # noqa
7+
schema_version=result_ml_object_schema_version, # noqa
8+
)
9+
10+
return_dict = {
11+
"data_output_path": str(Path("tests/data/data_output.csv").absolute()),
12+
"data_statistics_path": str(Path("tests/data/data_stats.csv").absolute()),
13+
"data_schemas_path": str(Path("tests/data/data_schemas.yaml").absolute()),
14+
"feature_file_path": str(Path("tests/data/feature_file.yaml").absolute()),
15+
}
16+
17+
results_ml_object.data_output_path = return_dict["data_output_path"]
18+
results_ml_object.data_statistics_path = return_dict["data_statistics_path"]
19+
results_ml_object.data_schemas_path = return_dict["data_schemas_path"]
20+
results_ml_object.feature_file_path = return_dict["feature_file_path"]

0 commit comments

Comments
 (0)