diff --git a/qgate_sln_mlrun/qualityreport.py b/qgate_sln_mlrun/qualityreport.py index 16d77bbb..68916b35 100644 --- a/qgate_sln_mlrun/qualityreport.py +++ b/qgate_sln_mlrun/qualityreport.py @@ -1,3 +1,5 @@ +import glob +import json import os from qgate_sln_mlrun.setup import Setup from qgate_sln_mlrun.output import Output @@ -21,7 +23,9 @@ def __init__(self, setup: Setup, output: Output): self._projects = [] self._project_specs = {} - self._vectors = {} + self._test_setting = {} + + self.load_test_setting() def build_scenarios_functions(self, delete_scenario=True, experiment_scenario=False) -> list[tsbase.TSBase]: test_scenario_functions = list(QualityReport.TEST_SCENARIOS) @@ -54,6 +58,21 @@ def execute(self, delete_scenario=True, experiment_scenario=False): self._output.render() self._output.close() + def load_test_setting(self): + """Load setting for test execution from model\03-test\* """ + + source_file = os.path.join(os.getcwd(), + self.setup.model_definition, + "03-test", + f"*-vector.json") + + # check existing data set + for file in glob.glob(source_file): + # iterate cross all featureset definitions + with open(file, "r") as json_file: + json_content = json.load(json_file) + self._test_setting['vector']=json_content["spec"] + @property def setup(self) -> Setup: return self._setup @@ -71,6 +90,5 @@ def project_specs(self) -> dict: return self._project_specs @property - def vectors(self) -> dict: - return self._vectors - + def test_setting(self) -> dict: + return self._test_setting \ No newline at end of file diff --git a/qgate_sln_mlrun/ts/ts401.py b/qgate_sln_mlrun/ts/ts401.py index cdb0d460..f6bc6c3b 100644 --- a/qgate_sln_mlrun/ts/ts401.py +++ b/qgate_sln_mlrun/ts/ts401.py @@ -62,10 +62,6 @@ def _create_featurevector_content(self, project_name, featurevector_name, featur self.project_switch(project_name) features = json_spec['features'] - # store information about vector testing - if json_spec.get('test'): - self.vectors[featurevector_name]=json_spec['test'] - # create feature vector vector = fstore.FeatureVector(featurevector_name, features, description=featurevector_desc) vector.save() diff --git a/qgate_sln_mlrun/ts/ts502.py b/qgate_sln_mlrun/ts/ts502.py index ea11508e..b09bb4a0 100644 --- a/qgate_sln_mlrun/ts/ts502.py +++ b/qgate_sln_mlrun/ts/ts502.py @@ -28,10 +28,16 @@ def get_data_online(self): Get data from on-line feature vector """ self.testscenario_new() - for project_name in self.projects: - for featurevector_name in self.get_featurevectors(self.project_specs.get(project_name)): - if featurevector_name in self.vectors: - if self.vectors[featurevector_name] == "online": + + vectors=None + if self.test_setting.get('vector'): + if self.test_setting['vector'].get('online'): + vectors=self.test_setting['vector']['online'] + + if vectors: + for project_name in self.projects: + for featurevector_name in self.get_featurevectors(self.project_specs.get(project_name)): + if featurevector_name in vectors: self._get_data_online(f"{project_name}/{featurevector_name}", project_name, featurevector_name) @TSBase.handler_testcase diff --git a/qgate_sln_mlrun/ts/tsbase.py b/qgate_sln_mlrun/ts/tsbase.py index a4670976..e5cfeca1 100644 --- a/qgate_sln_mlrun/ts/tsbase.py +++ b/qgate_sln_mlrun/ts/tsbase.py @@ -31,8 +31,8 @@ def project_specs(self) -> dict: return self._solution.project_specs @property - def vectors(self) -> dict: - return self._solution.vectors + def test_setting(self) -> dict: + return self._solution.test_setting @property def setup(self) -> Setup: