Skip to content

Commit

Permalink
Add instruction for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
george0st committed Dec 31, 2023
1 parent 74bd3ab commit 1e84b1c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
26 changes: 22 additions & 4 deletions qgate_sln_mlrun/qualityreport.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import glob
import json
import os
from qgate_sln_mlrun.setup import Setup
from qgate_sln_mlrun.output import Output
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
4 changes: 0 additions & 4 deletions qgate_sln_mlrun/ts/ts401.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 10 additions & 4 deletions qgate_sln_mlrun/ts/ts502.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions qgate_sln_mlrun/ts/tsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1e84b1c

Please sign in to comment.