]> git.parisson.com Git - timeside.git/commitdiff
better struture for task.run
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 4 Apr 2014 07:01:48 +0000 (09:01 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 4 Apr 2014 07:01:48 +0000 (09:01 +0200)
timeside/models.py

index 3c81219c20916653292b8e71093622b236e4b80e..59b918b0f3add7f043287650a456ea9bfa3a8b3d 100644 (file)
@@ -174,9 +174,6 @@ class Task(models.Model):
 
     def run(self):
         for item in self.items:
-            path = settings.MEDIA_ROOT + 'results' + os.sep + item.uuid + os.sep
-            if not item.hdf5:
-                item.hdf5 =  path + item.uuid + '.hdf5'
             pipe = FileDecoder(item.file)
             proc_dict = {}
             for processor in self.experience.processors.all():
@@ -184,9 +181,15 @@ class Task(models.Model):
                 #TODO: add parameters
                 proc_dict[processor] = proc
                 pipe = pipe | proc
+
             while item.lock:
                 time.sleep(30)
-    
+            
+            path = settings.MEDIA_ROOT + 'results' + os.sep + item.uuid + os.sep
+            if not item.hdf5:
+                item.hdf5 =  path + item.uuid + '.hdf5'
+                item.save()
+            
             try:
                 self.status_setter(2)
                 pipe.run()