6
0
Эх сурвалжийг харах

Resolve "predict and predict all in unmanaged data mode"

Eric Tröbs 4 жил өмнө
parent
commit
bd45ece17f

+ 2 - 2
pycs/pipeline/Fit.py

@@ -2,8 +2,8 @@ from pycs.pipeline.Job import Job
 
 
 class Fit(Job):
-    def __init__(self, project_id: str, data: dict):
-        super().__init__(project_id, data)
+    def __init__(self, project, data: dict):
+        super().__init__(project, data)
 
         self.result = []
         for identifier in data['predictionResults']:

+ 6 - 3
pycs/pipeline/Job.py

@@ -3,8 +3,11 @@ from uuid import uuid1
 
 
 class Job:
-    def __init__(self, project_id: str, data: dict):
+    def __init__(self, project, data: dict):
         self.id = uuid1()
         self.type = data['type']
-        self.path = path.join('projects', project_id, 'data', data['id'] + data['extension'])
-        self.size = data['size']
+
+        if project['unmanaged'] is None:
+            self.path = path.join('projects', project['id'], 'data', data['id'] + data['extension'])
+        else:
+            self.path = path.join(project['unmanaged'], data['id'] + data['extension'])

+ 7 - 2
pycs/pipeline/PipelineManager.py

@@ -25,7 +25,7 @@ class PipelineManager:
     def run(self, media_file):
         # create job list
         # TODO update job progress
-        job = Job(self.project['id'], media_file)
+        job = Job(self.project, media_file)
         result = tpool.execute(lambda p, j: p.execute(j), self.pipeline, job)
 
         # remove existing pipeline predictions from media_fle
@@ -40,7 +40,12 @@ class PipelineManager:
         data = []
 
         for identifier in self.project['data']:
-            fit = Fit(self.project['id'], self.project['data'][identifier])
+            fit = Fit(self.project, self.project['data'][identifier])
+            data.append(fit)
+
+        for key in self.project.unmanaged_files:
+            obj = self.project.unmanaged_files[key].get_data()
+            fit = Fit(self.project, obj)
             data.append(fit)
 
         self.pipeline.fit(data)

+ 8 - 3
pycs/projects/Project.py

@@ -162,9 +162,14 @@ class Project(ObservableDict):
         pipeline = self.__create_pipeline()
 
         # run jobs
-        for file_id in identifiers:
-            if file_id in self['data'].keys():
-                pipeline.run(self['data'][file_id])
+        if self['unmanaged'] is None:
+            for file_id in identifiers:
+                if file_id in self['data'].keys():
+                    pipeline.run(self['data'][file_id])
+        else:
+            for file_id in identifiers:
+                if file_id in self.unmanaged_files:
+                    pipeline.run(self.unmanaged_files[file_id])
 
         # schedule timeout thread
         self.quit_pipeline_thread = spawn_after(self.DEFAULT_PIPELINE_TIMEOUT, self.__quit_pipeline)

+ 2 - 0
webui/src/components/media/annotated-media-view.vue

@@ -97,6 +97,8 @@ export default {
       this.socket.post('/projects/' + this.currentProject.id, {
         'predict': [this.currentMedia.id]
       });
+
+      this.updateEvent();
     },
     filter: function (value) {
       this.filterValue = value;