|
@@ -1,7 +1,7 @@
|
|
from glob import glob
|
|
from glob import glob
|
|
from json import load, dump
|
|
from json import load, dump
|
|
from os import path, mkdir
|
|
from os import path, mkdir
|
|
-from shutil import rmtree
|
|
|
|
|
|
+from shutil import rmtree, copytree
|
|
from time import time
|
|
from time import time
|
|
from uuid import uuid1
|
|
from uuid import uuid1
|
|
|
|
|
|
@@ -39,29 +39,32 @@ class ProjectManager(ObservableDict):
|
|
with open(path.join('projects', uuid, 'project.json'), 'w') as file:
|
|
with open(path.join('projects', uuid, 'project.json'), 'w') as file:
|
|
copy = self[uuid].copy()
|
|
copy = self[uuid].copy()
|
|
del copy['jobs']
|
|
del copy['jobs']
|
|
|
|
+ del copy['model']
|
|
|
|
|
|
dump(copy, file, indent=4)
|
|
dump(copy, file, indent=4)
|
|
|
|
|
|
def create_project(self, name, description, model):
|
|
def create_project(self, name, description, model):
|
|
# create dict representation
|
|
# create dict representation
|
|
uuid = str(uuid1())
|
|
uuid = str(uuid1())
|
|
|
|
+
|
|
|
|
+ # create project directory
|
|
|
|
+ folder = path.join('projects', uuid)
|
|
|
|
+ mkdir(folder)
|
|
|
|
+
|
|
|
|
+ # copy model to project directory
|
|
|
|
+ copytree(self.parent['models'][model]['path'], path.join(folder, 'model'))
|
|
|
|
+
|
|
|
|
+ # create project object
|
|
self[uuid] = Project({
|
|
self[uuid] = Project({
|
|
'id': uuid,
|
|
'id': uuid,
|
|
'name': name,
|
|
'name': name,
|
|
'description': description,
|
|
'description': description,
|
|
'created': int(time()),
|
|
'created': int(time()),
|
|
- 'pipeline': {
|
|
|
|
- 'model-distribution': model
|
|
|
|
- },
|
|
|
|
'data': {},
|
|
'data': {},
|
|
'labels': {},
|
|
'labels': {},
|
|
'jobs': {}
|
|
'jobs': {}
|
|
}, self)
|
|
}, self)
|
|
|
|
|
|
- # create project directory
|
|
|
|
- folder = path.join('projects', uuid)
|
|
|
|
- mkdir(folder)
|
|
|
|
-
|
|
|
|
# create project.json
|
|
# create project.json
|
|
self.write_project(uuid)
|
|
self.write_project(uuid)
|
|
|
|
|