1 # ============LICENSE_START====================================================
3 # =============================================================================
4 # Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
5 # Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
6 # =============================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END======================================================
23 class FetchSchemaError(RuntimeError):
28 def __init__(self, path):
35 with open(self.path, 'r') as f:
36 self.ret = json.loads(f.read())
38 except Exception as e:
39 raise FetchSchemaError("Unexpected error from fetching schema", e)
42 schema_schema = _Schema('schemas/schema.json')
43 component_schema = _Schema('schemas/compspec.json')
44 dataformat_schema = _Schema('schemas/dataformat.json')
47 def get_metadata(model_repo_path, model_name):
48 # for now, assume it's called "metadata.json"
49 return json.loads(open("{0}/{1}/metadata.json".format(model_repo_path, model_name), "r").read())
52 def validate_format(meta, method, type):
54 Method to check for the metadata structure of the Acumos Model
55 due to change in tree structure of the input and output with Acumos-Demeter's release
56 Solution for Issue id: DCAEGEN2-2825
59 df_name = meta["methods"][method][type]["name"]
62 df_name = meta["methods"][method][type]