|
25 | 25 | PYTHON_VER_PATTERN = "^([3])(\.[6-9])(\.\d+)?$"
|
26 | 26 | PAR_URL = "https://objectstorage.us-ashburn-1.oraclecloud.com/p/q0qASrU7L7G1-BIVtoXOmvcEPMwYKoSVnp4Uum-31MwCYoSAahFLnHG8nA7AdLci/n/ociodscdev/b/service_conda_packs/o/service_pack/index.json"
|
27 | 27 | TESTS = {
|
28 |
| - 'score_py': {'key': 'score_py', 'category': 'Mandatory Files Check', 'description': 'Check that the file "score.py" exists and is in the top level directory of the artifact directory', 'error_msg': 'File score.py is not present.'}, |
29 |
| - 'runtime_yaml': {'category': 'Mandatory Files Check', 'description': 'Check that the file "runtime.yaml" exists and is in the top level directory of the artifact directory', 'error_msg': 'File runtime.yaml is not present.'}, |
30 |
| - 'score_syntax': {'category': 'score.py', 'description': 'Check for Python syntax errors', 'error_msg': 'Syntax error in score.py: '}, |
| 28 | + 'score_py': {'key': 'score_py', 'category': 'Mandatory Files Check', 'description': 'Check that the file "score.py" exists and is in the top level directory of the artifact directory', 'error_msg': 'The file \'score.py\' is missing.'}, |
| 29 | + 'runtime_yaml': {'category': 'Mandatory Files Check', 'description': 'Check that the file "runtime.yaml" exists and is in the top level directory of the artifact directory', 'error_msg': 'The file \'runtime.yaml\' is missing.'}, |
| 30 | + 'score_syntax': {'category': 'score.py', 'description': 'Check for Python syntax errors', 'error_msg': 'There is Syntax error in score.py: '}, |
31 | 31 | 'score_load_model': {'category': 'score.py', 'description': 'Check that load_model() is defined', 'error_msg': 'Function load_model is not present in score.py.'},
|
32 | 32 | 'score_predict': {'category': 'score.py', 'description': 'Check that predict() is defined', 'error_msg': 'Function predict is not present in score.py.'},
|
33 |
| - 'score_predict_data': {'category': 'score.py', 'description': 'Check that the only required argument for predict() is named "data"', 'error_msg': 'Function predict in score.py should have argument named "data".'}, |
34 |
| - 'score_predict_arg': {'category': 'score.py', 'description': 'Check that all other arguments in predict() are optional and have default values', 'error_msg': 'All other arguments in predict function in score.py should have default values.'}, |
35 |
| - 'runtime_version': {'category': 'runtime.yaml', 'description': 'Check that field MODEL_ARTIFACT_VERSION is set to 3.0', 'error_msg': 'In runtime.yaml field MODEL_ARTIFACT_VERSION should be set to 3.0'}, |
36 |
| - 'runtime_env_python': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_PYTHON_VERSION is set to a value of 3.6 or higher', 'error_msg': 'In runtime.yaml field MODEL_DEPLOYMENT.INFERENCE_PYTHON_VERSION is set to a value of 3.6 or higher'}, |
37 |
| - 'runtime_env_type': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is set to a value in (published, data_science)', 'error_msg': 'In runtime.yaml field MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE should be set to a value in (published, data_science)', 'warn': ""}, |
38 |
| - 'runtime_env_slug': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG is set', 'error_msg': 'In runtime.yaml field MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG should be set.'}, |
39 |
| - 'runtime_env_path': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_PATH is set', 'error_msg': 'In runtime.yaml field MODEL_DEPLOYMENT.INFERENCE_ENV_PATH should be set.'}, |
40 |
| - 'runtime_path_exist': {'category': 'conda_env', 'description': 'If MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is data_science and MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG is set, check that the file path in MODEL_DEPLOYMENT.INFERENCE_ENV_PATH is correct.', 'error_msg': "In runtime.yaml field MODEL_DEPLOYMENT.INFERENCE_ENV_PATH doesn't exist."}, |
41 |
| - 'runtime_slug_exist': {'category': 'conda_env', 'description': 'If MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is data_science, check that the slug listed in MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG exists.', 'error_msg': "In runtime.yaml the value of the fileld INFERENCE_ENV_SLUG doesn't exist in the given bucket."} |
| 33 | + 'score_predict_data': {'category': 'score.py', 'description': 'Check that the only required argument for predict() is named "data"', 'error_msg': 'The predict function in score.py must have a formal argument named \'data\'.'}, |
| 34 | + 'score_predict_arg': {'category': 'score.py', 'description': 'Check that all other arguments in predict() are optional and have default values', 'error_msg': 'All formal arguments in the predict function must have default values, except that \'data\' argument.'}, |
| 35 | + 'runtime_version': {'category': 'runtime.yaml', 'description': 'Check that field MODEL_ARTIFACT_VERSION is set to 3.0', 'error_msg': 'In runtime.yaml, the key MODEL_ARTIFACT_VERSION must be set to 3.0.'}, |
| 36 | + 'runtime_env_python': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_PYTHON_VERSION is set to a value of 3.6 or higher', 'error_msg': 'In runtime.yaml, the key MODEL_DEPLOYMENT.INFERENCE_PYTHON_VERSION must be set to a value of 3.6 or higher.'}, |
| 37 | + 'runtime_env_type': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is set to a value in (published, data_science)', 'error_msg': 'In runtime.yaml, the key MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE must be set to published or data_science.'}, |
| 38 | + 'runtime_env_slug': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG is set', 'error_msg': 'In runtime.yaml, the key MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG must have a value.'}, |
| 39 | + 'runtime_env_path': {'category': 'conda_env', 'description': 'Check that field MODEL_DEPLOYMENT.INFERENCE_ENV_PATH is set', 'error_msg': 'In runtime.yaml, the key MODEL_DEPLOYMENT.INFERENCE_ENV_PATH must have a value.'}, |
| 40 | + 'runtime_path_exist': {'category': 'conda_env', 'description': 'If MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is data_science and MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG is set, check that the file path in MODEL_DEPLOYMENT.INFERENCE_ENV_PATH is correct.', 'error_msg': "In runtime.yaml, the key MODEL_DEPLOYMENT.INFERENCE_ENV_PATH does not exist."}, |
| 41 | + 'runtime_slug_exist': {'category': 'conda_env', 'description': 'If MODEL_DEPLOYMENT.INFERENCE_ENV_TYPE is data_science, check that the slug listed in MODEL_DEPLOYMENT.INFERENCE_ENV_SLUG exists.', 'error_msg': "In runtime.yaml, the value of the key INFERENCE_ENV_SLUG is `slug_value` and it doesn't exist in the bucket `bucket_url`. Ensure that the value INFERENCE_ENV_SLUG and the bucket url are correct."} |
42 | 42 | }
|
43 | 43 |
|
44 | 44 | def combine_msgs(test_list) -> str:
|
@@ -101,8 +101,6 @@ def check_runtime_yml(file_path) -> Tuple[bool, str]:
|
101 | 101 | if msg:
|
102 | 102 | return False, msg
|
103 | 103 | try:
|
104 |
| - if TESTS['runtime_env_type']['value'] == 'published': |
105 |
| - TESTS['runtime_env_type']['warn'] = 'WARNING: Provide the correct access policy as INFERENCE_ENV_TYPE is published' |
106 | 104 | m = re.match(PYTHON_VER_PATTERN, str(TESTS['runtime_env_python']['value']))
|
107 | 105 | if m and m.group():
|
108 | 106 | TESTS['runtime_env_python']['success'] = True
|
@@ -182,7 +180,8 @@ def check_score_file(file_path) -> Tuple[bool, str]:
|
182 | 180 |
|
183 | 181 | except SyntaxError as e:
|
184 | 182 | TESTS['score_syntax']['success'] = False
|
185 |
| - return False, TESTS['score_syntax']['error_msg'] + str(e) # error message has ": " e has syntax error details |
| 183 | + TESTS['score_syntax']['error_msg'] = TESTS['score_syntax']['error_msg'] + str(e) # error message has ": " e has syntax error details |
| 184 | + return False, TESTS['score_syntax']['error_msg'] |
186 | 185 |
|
187 | 186 | def check_mandatory_files(files_present) -> Tuple[bool, str]:
|
188 | 187 | '''
|
@@ -279,9 +278,6 @@ def write_html(output_path) -> None:
|
279 | 278 | result = get_test_result(key)
|
280 | 279 | html_response += f'<tr class="{css_classes[result]}"><th class="{count_classes[count%2]}">{count}</th><td>{key}</td><td>{TESTS[key]["description"]}</td><td>{out_classes[result]}</td>'
|
281 | 280 |
|
282 |
| - if key == 'runtime_env_type' and len(TESTS[key]["warn"]) > 0: |
283 |
| - html_response += f'<td>{TESTS[key]["warn"]}</td></tr></body>' |
284 |
| - |
285 | 281 | if get_test_result(key) == 1:
|
286 | 282 | html_response += f'<td>{TESTS[key]["error_msg"]}</td></tr></body>'
|
287 | 283 | else:
|
|
0 commit comments