From: Guillaume Pellerin Date: Fri, 4 Apr 2014 07:01:48 +0000 (+0200) Subject: better struture for task.run X-Git-Tag: 0.5.5~1^2~62 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=39cd2b6dd31f61c678c42de0458e8a5c67a4b6fe;p=timeside.git better struture for task.run --- diff --git a/timeside/models.py b/timeside/models.py index 3c81219..59b918b 100644 --- a/timeside/models.py +++ b/timeside/models.py @@ -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()