Fix resolving dependencies in workflow

Change-Id: I9024165a2f4b745ebd85d09baff6138f1388e152
This commit is contained in:
Nikolay Mahotkin
2013-12-18 14:03:03 +04:00
parent 3fa58bfb8f
commit cf4a016143
2 changed files with 12 additions and 15 deletions

View File

@@ -79,17 +79,14 @@ def _update_dependencies(tasks, graph):
def _get_resolved_tasks(tasks):
resolved_tasks = []
allows = []
for t in tasks:
if t['state'] == states.SUCCESS:
allows += t['dependencies']
allow_set = set(allows)
for t in tasks:
if len(allow_set - set(t['dependencies'])) == 0:
if t['state'] == states.IDLE:
resolved_tasks.append(t)
return resolved_tasks
resolved_tasks = []
allows = []
for t in tasks:
if t['state'] == states.SUCCESS:
allows += [t['name']]
allow_set = set(allows)
for t in tasks:
if len(set(t['dependencies']) - allow_set) == 0:
if t['state'] == states.IDLE:
resolved_tasks.append(t)
return resolved_tasks

View File

@@ -30,7 +30,7 @@ TASKS = [
{
'dependencies': [],
'name': 'create-vms',
'state': states.RUNNING
'state': states.SUCCESS
},
{
'dependencies': ['create-vms'],