Commit 8041ee10 authored by Janez K's avatar Janez K
Browse files

procesiranje streamov s for loopi

parent f8933ac2
......@@ -14,11 +14,30 @@ class Stream(models.Model):
def execute(self,workflow=None,outputs={}):
if workflow is None:
workflow = self.workflow
finished = []
ready_to_run = []
widgets = workflow.widgets.all()
#get unfinished
if workflow.is_for_loop():
fi = workflow.widgets.filter(type='for_input')[0]
fo = workflow.widgets.filter(type='for_output')[0]
outer_output = fo.inputs.all()[0].outer_output
outputs[outer_output.pk]=(outer_output.variable,[])
input_list = []
try:
if fi.outputs.all()[0].outer_input.connections.count() > 0:
input_list = outputs[fi.outputs.all()[0].outer_input.connections.all()[0].output.pk][1]
except:
input_list = []
else:
input_list = [0]
#print input_list
for for_input in input_list:
#print for_input
finished = []
unfinished_list = []
loop = True
while loop:
......@@ -57,19 +76,21 @@ class Stream(models.Model):
if w.type == 'subprocess':
new_outputs = self.execute(workflow=w.workflow_link,outputs=outputs)
for o in w.outputs.all():
value = None
try:
if o.inner_input.connections.count() > 0:
value = new_outputs[o.inner_input.connections.all()[0].output.pk][1]
outputs[o.pk]=new_outputs[o.pk]
except:
value = None
output_dict[o.variable]=value
outputs[o.pk]=(o.variable,None)
if w.type == 'for_input':
pass
for o in w.outputs.all():
outputs[o.pk]=(o.variable,for_input)
#print outputs[o.pk]
output_dict[o.variable]=for_input
if w.type == 'for_output':
pass
for i in w.inputs.all():
outputs[i.outer_output.pk][1].append(input_dict[i.variable])
output_dict[i.variable]=input_dict[i.variable]
if w.type == 'input':
for o in w.outputs.all():
......@@ -82,8 +103,11 @@ class Stream(models.Model):
output_dict[o.variable]=value
if w.type == 'output':
pass
for i in w.inputs.all():
outputs[i.outer_output.pk]=(i.outer_output.variable,input_dict[i.variable])
if w.type != 'subprocess':
for o in w.outputs.all():
outputs[o.pk]=(o.variable,output_dict[o.variable])
......
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