Commit 4e3b87ab authored by Betoule Marc's avatar Betoule Marc
Browse files

Try to come up with a glob_seg working properly for segments without tasks

parent f0ab83ab
......@@ -199,14 +199,17 @@ class Environment(EnvironmentBase):
"""
str_parents = self._worker.task.str_parents
if segs is None:
segs = str_parents.keys
segs = str_parents.keys()
res=[]
for x in segs:
segx = self._worker.pipe.find_seg(self._worker.task.seg, x)
if segx is None:
self.logger.warning("No parent segment matching %s found"%x)
for t in str_parents[segx]:
res+=glob(path.join(self._worker.pipe.get_data_dir(segx),t,y))
if not str_parents[segx]:
res+=glob(path.join(self._worker.pipe.get_data_dir(segx),y))
else:
for t in str_parents[segx]:
res+=glob(path.join(self._worker.pipe.get_data_dir(segx),t,y))
return res
def glob_seg_all(self, x, y):
......
......@@ -172,11 +172,9 @@ class TaskList:
if directive.where:
f = multiplex._where(parent_list, directive.where)
output_set = filter(f, output_set)
if directive.group_by:
output_set = multiplex._group(output_set, parent_list, directive.group_by)
lst_task = [Task(seg, e[0], status='queued', parents=list(set(e[1]))) for e in output_set]
## make the list of task to push, input are dictionnaries
else:
lst_task = [Task(seg, make_dict([(r[2],r[0]) for r in e]), status='queued', parents=list(set([r[1] for r in e if r[1] is not None]))) for e in output_set]
......
......@@ -329,14 +329,14 @@ class SqliteTracker(Tracker,threading.Thread):
t.id = c.lastrowid
logger.debug('for task:\n%s\nparents:\n%s\n'%(str(t),str(t.parents)))
self.conn.executemany('insert into task_relations (father_id, child_id) values (?, ?)',((fid, t.id) for fid in t.parents))
for p in self.pipe.get_parents(t.seg):
t.str_parents[p] = []
for fid in t.parents:
c = self.conn.execute('select seg_id, str_input from tasks where task_id=?', ((fid,)))
for e in c:
s = self.seg_name_cache[e[0]]
try:
t.str_parents[s].append(e[1])
except KeyError:
t.str_parents[s] = [e[1]]
t.str_parents[s].append(e[1])
return t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment