Skip to content

Commit

Permalink
UC101 finish
Browse files Browse the repository at this point in the history
  • Loading branch information
george0st committed Nov 11, 2023
1 parent 1eda05e commit 23ed380
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
21 changes: 12 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
from qgate.uc.uc101 import UC101
from qgate.uc import ucsetup, ucoutput


if __name__ == '__main__':

def test():
setup= ucsetup.UCSetup("0-size-100",
["qgate-sln-mlrun-private.env", "qgate-sln-mlrun.env"])

ucoutput.UCOutput(setup)
aa=UC101(setup)
aa.exec()

# sln = qgate.Solution("0-size-100",
# ["qgate-sln-mlrun-private.env", "qgate-sln-mlrun.env"])
# try:
# sln.create(force=True)
# finally:
# sln.delete()
if __name__ == '__main__':

# test()

sln = qgate.Solution("0-size-100",
["qgate-sln-mlrun-private.env", "qgate-sln-mlrun.env"])
try:
sln.create(force=True)
finally:
sln.delete()
2 changes: 1 addition & 1 deletion qgate/uc/uc101.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def desc(self):
def exec(self):

# create projects
dir=os.path.join(os.getcwd(), self._model_definition, "01-model", "01-project", "*.json")
dir=os.path.join(os.getcwd(), self.setup.model_definition, "01-model", "01-project", "*.json")
for file in glob.glob(dir):
with open(file, "r") as json_file:
json_content = json.load(json_file)
Expand Down
15 changes: 11 additions & 4 deletions qgate/uc/ucbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ def __init__(self, setup: UCSetup, name):
self._setup=setup
self._name=name

@property
def setup(self):
return self._setup

@property
def desc(self):
raise NotImplemented()

@property
def name(self):
return self._name

def exec(self):
raise NotImplemented()

def _get_json_header(self, json_content):
""" Get common header from config files
Expand All @@ -40,10 +51,6 @@ def _get_json_header(self, json_content):
lbls = None if json_content.get('labels') is None else json_content.get('labels')
return name, desc, lbls, kind

@property
def name(self):
return self._name

@staticmethod
def str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
Expand Down
3 changes: 1 addition & 2 deletions qgate/uc/ucoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ def __del__(self):
self._file.close()

def _headr(self):
self._print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
self._print("QGate version: " + __version__)

self._print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))

def _footer(self):
total, free = self._memory()
Expand Down
6 changes: 5 additions & 1 deletion qgate/uc/ucsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ def __str__(self):

@property
def model_output(self):
return self._model_output
return self._model_output

@property
def model_definition(self):
return self._model_definition

0 comments on commit 23ed380

Please sign in to comment.